lua-users home
lua-l archive

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




On 08/07/15 11:12 PM, Luiz Henrique de Figueiredo wrote:
Use
	debug.setmetatable(nil, {__index = {}})

See http://lua-users.org/lists/lua-l/2010-05/msg00159.html

I should make a library for this that doesn't require debug.

Maybe something like "local f = mkgetter("a", "b", "c", ...)" or "local f = mkgetter().a.b.c()" and then "if f(obj) then", maybe even return the depth as a second return so like local value, depth = f(obj), depth could be negative if the second arg was true as in f(obj, true).

It obviously won't use pcall as that's slow. Might use tail calls because I love tail calls. :P

--
Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.