diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-23 10:16:18 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-23 10:16:18 -0300 |
commit | 9243c414d92c253edd908f438caa31e2aa16f3f4 (patch) | |
tree | e8959a48f4672037aef061cc6eb82bba21d0766b /ltm.c | |
parent | 477ca2fe8ceaf79038972977915987adbef0e425 (diff) | |
download | lua-9243c414d92c253edd908f438caa31e2aa16f3f4.tar.gz lua-9243c414d92c253edd908f438caa31e2aa16f3f4.tar.bz2 lua-9243c414d92c253edd908f438caa31e2aa16f3f4.zip |
first version of empty entries in tables
(so that, in the future, tables can contain regular nil entries)
Diffstat (limited to 'ltm.c')
-rw-r--r-- | ltm.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.c,v 2.62 2018/02/17 19:20:00 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 2.63 2018/02/21 15:49:32 roberto Exp roberto $ |
3 | ** Tag methods | 3 | ** Tag methods |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -60,7 +60,7 @@ void luaT_init (lua_State *L) { | |||
60 | const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { | 60 | const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { |
61 | const TValue *tm = luaH_getshortstr(events, ename); | 61 | const TValue *tm = luaH_getshortstr(events, ename); |
62 | lua_assert(event <= TM_EQ); | 62 | lua_assert(event <= TM_EQ); |
63 | if (ttisnil(tm)) { /* no tag method? */ | 63 | if (notm(tm)) { /* no tag method? */ |
64 | events->flags |= cast_byte(1u<<event); /* cache this fact */ | 64 | events->flags |= cast_byte(1u<<event); /* cache this fact */ |
65 | return NULL; | 65 | return NULL; |
66 | } | 66 | } |
@@ -137,9 +137,9 @@ void luaT_callTMres (lua_State *L, const TValue *f, const TValue *p1, | |||
137 | static int callbinTM (lua_State *L, const TValue *p1, const TValue *p2, | 137 | static int callbinTM (lua_State *L, const TValue *p1, const TValue *p2, |
138 | StkId res, TMS event) { | 138 | StkId res, TMS event) { |
139 | const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ | 139 | const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ |
140 | if (ttisnil(tm)) | 140 | if (notm(tm)) |
141 | tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ | 141 | tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ |
142 | if (ttisnil(tm)) return 0; | 142 | if (notm(tm)) return 0; |
143 | luaT_callTMres(L, tm, p1, p2, res); | 143 | luaT_callTMres(L, tm, p1, p2, res); |
144 | return 1; | 144 | return 1; |
145 | } | 145 | } |