lua-users home
lua-l archive

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


Den 2012-08-31 14:18, skrev Patrick Rapin:
Once a newbie, always a newbie
Your code is certainly not a newbie's one. Metatables are a powerful
concept for advanced users.
And you use the inexistent __gt metamethod. An "advanced newbie" would
have double checked in the documentation for the name of the
metamethod.
This error shows that you are so fluent in Lua language that you don't
check your memory anymore.



A recent, more newbish gotcha of mine was something like:

-----
function Do(_a,_b)
 local a,b = _a,_b,
 print('Doing ', a , b)
 -- doing more stuff on a and b
end

Do('well', 'now')
-----

I was confused that the thing worked, but the log said 'Doing nil     nil'.
This was innocent, but it should not be difficult constuct more interesting effects by straying ',' behind assignments.

Egil