summaryrefslogtreecommitdiff
path: root/src/lj_meta.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_meta.c')
-rw-r--r--src/lj_meta.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/lj_meta.c b/src/lj_meta.c
index fcb9df66..278d2d34 100644
--- a/src/lj_meta.c
+++ b/src/lj_meta.c
@@ -309,10 +309,19 @@ TValue * LJ_FASTCALL lj_meta_len(lua_State *L, cTValue *o)
309{ 309{
310 cTValue *mo = lj_meta_lookup(L, o, MM_len); 310 cTValue *mo = lj_meta_lookup(L, o, MM_len);
311 if (tvisnil(mo)) { 311 if (tvisnil(mo)) {
312 lj_err_optype(L, o, LJ_ERR_OPLEN); 312#ifdef LUAJIT_ENABLE_LUA52COMPAT
313 return NULL; /* unreachable */ 313 if (tvistab(o))
314 tabref(tabV(o)->metatable)->nomm |= (uint8_t)(1u<<MM_len);
315 else
316#endif
317 lj_err_optype(L, o, LJ_ERR_OPLEN);
318 return NULL;
314 } 319 }
320#ifdef LUAJIT_ENABLE_LUA52COMPAT
321 return mmcall(L, lj_cont_ra, mo, o, o);
322#else
315 return mmcall(L, lj_cont_ra, mo, o, niltv(L)); 323 return mmcall(L, lj_cont_ra, mo, o, niltv(L));
324#endif
316} 325}
317 326
318/* Helper for equality comparisons. __eq metamethod. */ 327/* Helper for equality comparisons. __eq metamethod. */