-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
Hey, creator of LuaConsole here!
Don't do this, but once I written a vector 2d class using metatables to capture invalid indexes of tables.
local tab = { pairs = {}, }
setmetatable(tab, {
__index = function(k, i)
return k.pairs[i[1]][i[2]];
end;
})
-- So you would be able to
tab.pairs[1][1] = 1
tab.pairs[1][2] = 2
print(tab[{1, 2}])
Metadata
Metadata
Assignees
Labels
No labels