lua-users home
lua-l archive

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


Peter Cawley wrote:
In plain Lua, it might be done like:

function how(s, x) return debug.getinfo(1).namewhat == "method" and
":" or "." end
t = {how = how}
print(t.how()) --> .
print(t:how()) --> :

Except that then breaks legitimate uses, ie when caching the function lookup for a tight inner loop.

local setAngle = bot.setAngle
for angle = 0,math.pi,0.0001 do
 setAngle(bot, angle)
end