lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Thank you, this is really very "luaistic"... :).

So the second function after return is executed first... .

I am just trying to improve my Lua skills with codewars.com (which I
can really recommend for this purpose, also to compare different
problem solve approachs in different languages, codewars supports ca.
30-50 languages).

Am So., 11. Sept. 2022 um 10:33 Uhr schrieb Lars Müller <appgurulars@gmx.de>:
>
> Remember that function arguments are evaluated before applying the function to them. What this construction does is that it first unpacks the removed elements, pushing them on the stack; this is then passed as an argument to a function to avoid having to store them in a table or the like. The function then calls table.move and returns the removed elements afterwards. In the end this is a clever trick to "store" a vararg on the stack.