From 151c5b2c713961775dceef7c2ef55ef2a0bd8d16 Mon Sep 17 00:00:00 2001 From: kenshin Date: Mon, 2 Dec 2013 11:48:20 +0800 Subject: [PATCH] new metamethod __len,__pairs,__ipairs in lua 5.2 --- middleclass.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/middleclass.lua b/middleclass.lua index 0aae817..6151af3 100644 --- a/middleclass.lua +++ b/middleclass.lua @@ -97,7 +97,8 @@ end local Object = _createClass("Object", nil) Object.static.__metamethods = { '__add', '__call', '__concat', '__div', '__le', '__lt', - '__mod', '__mul', '__pow', '__sub', '__tostring', '__unm' } + '__mod', '__mul', '__pow', '__sub', '__tostring', '__unm', + '__len','__pairs','__ipairs'} function Object.static:allocate() assert(type(self) == 'table', "Make sure that you are using 'Class:allocate' instead of 'Class.allocate'")