|
Please take a look at my new PowerPatch at http://lua-users.org/wiki/LuaPowerPatches. This allows the Table and Userdata types to have type metatables without losing their current per-object ones. This new mechanism is then used to expose the Table Library as methods of Table objects in the same way the String Library is exposed for String objects. (Logically, 'pairs', 'ipairs' and 'next' should also be exposed as methods, but I have not done that in the patch.) For very little cost, this makes Lua more consistent and also adds a powerful new generalised mechanism for others to build on. While there, you could maybe take another look at my 'Self-iterating Objects' patch further down the same page. Having used this extensively myself over the last few years, I am more than ever convinced this is a worthwhile improvement. |