Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- aTable = {}
- for x=1,10,1 do
- aTable[x] = x
- end
- -- Metatable em Lua
- mt = {
- __add = function(table1, table2)
- sumTable = {}
- for y=1,#table1,1 do
- if (table1[y] ~= nil) and (table2[y] ~= nil) then
- sumTable[y] = table1[y] + table2[y]
- else
- sumTable[y] = 0
- end
- end
- print("FUNCIONA!!")
- return sumTable
- end,
- __eq = function(table1, table2)
- print("FUNCIONA!!")
- return table1.value == table2.value
- end,
- __lt = function(table1, table2)
- return table1.value < table2.value
- end,
- __le = function(table1, table2)
- return table1.value <= table2.value
- end,
- }
- setmetatable(aTable, mt)
- --print(aTable == aTable)
- addTable = {}
- if aTable == aTable then
- local bool = (aTable == aTable)
- addTable = aTable + aTable --and true or false
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement