From f7f85b0826f7006b8dcc040111cd0ef8d42c2352 Mon Sep 17 00:00:00 2001 From: Philipp Janda Date: Mon, 19 Jan 2015 19:12:24 +0100 Subject: prepare to use ltablib.c from 5.3 for table library --- c-api/compat-5.3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'c-api') diff --git a/c-api/compat-5.3.c b/c-api/compat-5.3.c index ecb22b0..e45c728 100644 --- a/c-api/compat-5.3.c +++ b/c-api/compat-5.3.c @@ -36,7 +36,8 @@ COMPAT53_API void lua_len (lua_State *L, int i) { switch (lua_type(L, i)) { case LUA_TSTRING: /* fall through */ case LUA_TTABLE: - lua_pushnumber(L, (int)lua_objlen(L, i)); + if (!luaL_callmeta(L, i, "__len")) + lua_pushnumber(L, (int)lua_objlen(L, i)); break; case LUA_TUSERDATA: if (luaL_callmeta(L, i, "__len")) -- cgit v1.2.3-55-g6feb