lua-users home
lua-l archive

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


> > sort(list,function(a,b) return tostring(a)<tostring(b) end)
> 
> Wow, I didn;t know you could define functions as part of the 
> parameter list!

Functions first class objects. Its like a lambda function in Python (or
Perl??) if you've used those. I think a function is just a closure assigned
to a variable. If you paste code into
http://doris.sourceforge.net/lua/weblua.php and hit the luac button you can
get an understanding of what Lua compiles into and how it all works (Good if
you want efficient code).

> Thanks for the links, very useful. I found a good source 
> of example code there too.