Is this metamethod __isdef bug?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Is this metamethod __isdef bug?

actboy168@gmail.com
This is the test code.

> local mt = {}
> function mt:__isdef()
> return true
> end
> local t = setmetatable({}, mt)
> print(t.a == undef)

And the output is:
> >>lua test.lua
> lua: test.lua:6: attempt to call a boolean value (global 'print')
> stack traceback:
>         test.lua:6: in main chunk
>         [C]: in ?



-- actboy168
Reply | Threaded
Open this post in threaded view
|

Re: Is this metamethod __isdef bug?

Roberto Ierusalimschy
> This is the test code.
>
> > local mt = {}
> > function mt:__isdef()
> > return true
> > end
> > local t = setmetatable({}, mt)
> > print(t.a == undef)
>
> And the output is:
> > >>lua test.lua
> > lua: test.lua:6: attempt to call a boolean value (global 'print')
> > stack traceback:
> >         test.lua:6: in main chunk
> >         [C]: in ?

Yes, this is a bug. Thanks for the report.

-- Roberto