Posted 10 November 2013 - 03:50 PM
I've implemented the __len metamethod in CCLua :D/>.
Pastebin: Zfnv2FZC
How it works:
I overrode setmetatable so that it archives any tables that come in and returns a table that has the length of __len of its metatable (or the length of the table if __len doesn't exist) and that table has a metatable whose __index points to the archived table and whose __newindex redirects all changes to the archived table.
Enjoy!
Pastebin: Zfnv2FZC
How it works:
I overrode setmetatable so that it archives any tables that come in and returns a table that has the length of __len of its metatable (or the length of the table if __len doesn't exist) and that table has a metatable whose __index points to the archived table and whose __newindex redirects all changes to the archived table.
Enjoy!
Edited on 10 November 2013 - 02:51 PM