Ando Sonenblick
2003-12-12 13:49:41 UTC
Gang,
Thanks to all for help with my lua question about auto initing nil
values in a table to zero...
A couple replies utilize the __call metamethod. I'm not terribly
familiar with this one and the manual only has this to say about it:
"call": called when Lua calls a value.
function function_event (func, ...)
if type(func) == "function" then
return func(unpack(arg)) -- primitive call
else
local h = metatable(func).__call
if h then
return h(func, unpack(arg))
else
error("...")
end
end
end
Can anyone give me more info on this? What exactly does it mean when
"Lua calls a value"?
Can I use this to distinguish between obj:Method() and obj.method?
Thanks for any insight...
Ando
-----------------------
Ando Sonenblick
SpriTec Software
www.spritec.com
Thanks to all for help with my lua question about auto initing nil
values in a table to zero...
A couple replies utilize the __call metamethod. I'm not terribly
familiar with this one and the manual only has this to say about it:
"call": called when Lua calls a value.
function function_event (func, ...)
if type(func) == "function" then
return func(unpack(arg)) -- primitive call
else
local h = metatable(func).__call
if h then
return h(func, unpack(arg))
else
error("...")
end
end
end
Can anyone give me more info on this? What exactly does it mean when
"Lua calls a value"?
Can I use this to distinguish between obj:Method() and obj.method?
Thanks for any insight...
Ando
-----------------------
Ando Sonenblick
SpriTec Software
www.spritec.com