Lua無名元表
439 ワード
--[[
]]
function less(t1,t2)
return table.getn(t1) < table.getn(t2)
end
do
local t1={1,2,3}
setmetatable(t1,{['__lt']=less})
local t2={1,2,4}
setmetatable(t2,{['__lt']=less})
print(t1<t2)
mt1=getmetatable(t1)
print(mt1.__lt)
mt2=getmetatable(t2)
print(mt2.__lt)
print(t1<=t2)
--[[
?
false
function: 006DCF10
function: 006DCF10
true
]]
end