From 29cd1a791e3d35dd1971f32b5673264a7d9e44f9 Mon Sep 17 00:00:00 2001 From: "James D. Callahan III" Date: Sun, 13 Mar 2011 17:12:26 -0500 Subject: [PATCH] Fix for nil trainer and escape double-quotes in trainer names so they'll dump properly. Damn "\"Cookie\" McWeaksauce". --- Scanner.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Scanner.lua b/Scanner.lua index 9d0e7d6..f025f73 100644 --- a/Scanner.lua +++ b/Scanner.lua @@ -592,10 +592,12 @@ do local trainer = private.trainer_list[identifier] local trainer_name - if trainer.spell_id then - table.insert(output, ("AddTrainer(%s, %s, \"%s\", %s, %s, \"%s\")"):format(identifier, trainer.spell_id, trainer.location, trainer.coord_x, trainer.coord_y, trainer.faction)) - else - table.insert(output, ("AddTrainer(%s, \"%s\", \"%s\", %s, %s, \"%s\")"):format(identifier, trainer.name, trainer.location, trainer.coord_x, trainer.coord_y, trainer.faction)) + if trainer then + if trainer.spell_id then + table.insert(output, ("AddTrainer(%s, %s, \"%s\", %s, %s, \"%s\")"):format(identifier, trainer.spell_id, trainer.location, trainer.coord_x, trainer.coord_y, trainer.faction)) + else + table.insert(output, ("AddTrainer(%s, \"%s\", \"%s\", %s, %s, \"%s\")"):format(identifier, trainer.name:gsub("\"", "\\\""), trainer.location, trainer.coord_x, trainer.coord_y, trainer.faction)) + end end end addon:DisplayTextDump(nil, nil, table.concat(output, "\n")) -- 1.7.9.5