lua-users home
lua-l archive

Re: Function as metatable (metafunctions?)

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


On Mon, Mar 31, 2014 at 12:14 PM, Petite Abeille
<petite.abeille@gmail.com> wrote:
> local aFunction = function() end
> debug.setmetatable( aFunction, { __tostring = function() return 'm e t a f u n c t i o n' end } )
> print( aFunction )
....
local anotherFunction = function() .... end
print (anotherFunction)
so, you can't set metatable to _a_ function, you set the global
function type's metatable
-- 
Javier

AltStyle によって変換されたページ (->オリジナル) /