Be careful as there is a subtle difference between “return” and “return nil”:
[lua]local f1 = function() return end
local f2 = function() return nil end
local f3 = function() return false end
local f4 = function() return true end
local ff = function(…) print(select("#",…),",",select(1,…),",", select(1,…)) end
ff(f1())
ff(f2())
ff(f3())
ff(f4())[/lua]
yields:
[lua]0 , nil ,
1 , nil , nil
1 , false , false
1 , true , true[/lua]
Which seems to imply that “return” truly doesn’t seem to return anything, which is different from “return nil”, where the latter returns a real nil. Most of the time that difference is not visible, unless you count argument-values with select.
Just one of those nasty nil-gotchas in Lua that can bite you when you don’t expect it…
-FrankS. [import]uid: 8093 topic_id: 9319 reply_id: 35664[/import]