lua-users home
lua-l archive

Lua 5.4.0 (work1), undef and metatable

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


Hello,
I'd like to note that operations with undef seem to ignore metatables:
Lua 5.4.0 (work1) Copyright (C) 1994-2018 Lua.org, PUC-Rio
> =undef
stdin:1: 'undef' is not a value!!
> a=setmetatable({},{__index=print,__newindex=print})
> a[1]=1
table: 0x93cc280 1 1
> a[1]=undef
> a[2]=nil
table: 0x93cc280 2 nil
> a[3]=undef
> =a[1]==nil
table: 0x93cc280 1
true
> =a[1]==undef
true
No metamethod calls occur for the undef assignment and check. This
doesn't seem right.
Best regards,
-- 
DoubleF

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