LL functions could discard extra parameters instead of throwing a run-time error
SuzannaLinn Resident
For instance:
local greet = "Hello World"
ll.Say(0, greet:gsub("World", "SecondLife"))
--> Script run-time error: invalid argument #2 to 'Say' (Different number of arguments than expected)
Because
string:gsub()
returns the resulting string and the number of substitutions. But:function say(msg) ll.Say(0, msg) end
local greet = "Hello World"
say(greet:gsub("World", "SecondLife"))
-- > Hello SecondLife
SLua functions discard extra parameters.
Of course we can adjust the return:
local greet = "Hello World"
ll.Say(0, (greet:gsub("World", "SecondLife")))
-- > Hello SecondLife
But discarding extra parameters would be a more Lua behaviour.
Log In