forked from your-land-mirror/yl_speak_up
fixed two bugs in replacing vars in text
This commit is contained in:
parent
2b7db390c5
commit
9d2fb157d0
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user