diff --git a/api/custom_functions_you_can_override.lua b/api/custom_functions_you_can_override.lua index fdafdef..0ad3cc7 100644 --- a/api/custom_functions_you_can_override.lua +++ b/api/custom_functions_you_can_override.lua @@ -24,6 +24,9 @@ yl_speak_up.replace_vars_in_text = function(text, dialog, pname) PLAYER_NAME = pname, } + if(not(text) or text == "") then + return "" + end -- only try to replace variables if there are variables inside the text if(string.find(text, "$VAR ")) then local varlist = yl_speak_up.get_quest_variables(dialog.npc_owner, true) @@ -32,7 +35,7 @@ yl_speak_up.replace_vars_in_text = function(text, dialog, pname) -- only allow to replace unproblematic variable names if(not(string.find(v_name, "[^%w^%s^_^%-^%.]"))) then -- remove leading $ from $ var_owner_name var_name - subs["VAR "..v_name] = yl_speak_up.get_quest_variable_value(dialog.npc_owner, v) or "- not set -" + subs["VAR "..v_name] = yl_speak_up.get_quest_variable_value(pname, v) or "- not set -" end end end