From 7ee7911d6b2b0d05b03050338090f44487d6a122 Mon Sep 17 00:00:00 2001 From: Christopher Date: Wed, 17 Aug 2016 16:15:28 +0100 Subject: [PATCH] Renamed args to options. Fixed variable substitution on option text. --- .../FungusLua/Resources/Lua/fungus.txt | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Assets/Fungus/Thirdparty/FungusLua/Resources/Lua/fungus.txt b/Assets/Fungus/Thirdparty/FungusLua/Resources/Lua/fungus.txt index 99b9e99d..24017d0e 100644 --- a/Assets/Fungus/Thirdparty/FungusLua/Resources/Lua/fungus.txt +++ b/Assets/Fungus/Thirdparty/FungusLua/Resources/Lua/fungus.txt @@ -252,36 +252,36 @@ end -- Display a list of menu options and wait for user to choose one. -- Returns the index of the selected option. -- Returns 0 if options list is empty. Note: Lua array indices start at 1, not 0). --- args: an array of option strings. e.g. choose{ "Option 1", "Option 2" } -function M.choose(args) - return M.choosetimer(args, 0, 0) +-- options: an array of option strings. e.g. { "Option 1", "Option 2" } +function M.choose(options) + return M.choosetimer(options, 0, 0) end -- Display a list of menu options and wait for user to choose one, or for a timer to expire. -- Returns the index of the selected option, or the defaultoption if the timer expires. -- Returns 0 if options list is empty. Note: Lua array indices start at 1, not 0). --- args: an array of option strings. e.g. choose{ "Option 1", "Option 2" } +-- options: an array of option strings. e.g. { "Option 1", "Option 2" } -- duration: Time player has to pick an option. -- defaultoption: Option index to return if the timer expires. -function M.choosetimer(args, duration, defaultoption) - if (args == nil or #args == 0) then +function M.choosetimer(options, duration, defaultoption) + if (options == nil or #options == 0) then return 0 end local md = M.getmenudialog() - -- Do variable substitution before displaying text - local subbed = M.sub(text) - local selection = 0 - for i, name in ipairs(args) do + for i, text in ipairs(options) do local callback = function () selection = i; end - md.AddOption(name, true, M.luaenvironment, callback) + -- Do variable substitution before displaying text + local subbed = M.sub(text) + + md.AddOption(subbed, true, M.luaenvironment, callback) end if (duration > 0) then