aboutsummaryrefslogtreecommitdiff
path: root/src/lua/ltm.c
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2021-03-03 21:31:01 +0800
committerLi Jin <dragon-fly@qq.com>2021-03-03 21:33:37 +0800
commit1df786307c1983b8ce693e3916081a8bcd4e95ae (patch)
tree6c7aeb2198d825877fd3d179c394b7a5c1f06a17 /src/lua/ltm.c
parent66168b112b707172b9035edf8c1daed469781e06 (diff)
downloadyuescript-1df786307c1983b8ce693e3916081a8bcd4e95ae.tar.gz
yuescript-1df786307c1983b8ce693e3916081a8bcd4e95ae.tar.bz2
yuescript-1df786307c1983b8ce693e3916081a8bcd4e95ae.zip
add new metatable syntax for issue #41, fix reusing local variable issue, update built-in Lua.
Diffstat (limited to 'src/lua/ltm.c')
-rw-r--r--src/lua/ltm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lua/ltm.c b/src/lua/ltm.c
index 4770f96..b657b78 100644
--- a/src/lua/ltm.c
+++ b/src/lua/ltm.c
@@ -147,7 +147,7 @@ static int callbinTM (lua_State *L, const TValue *p1, const TValue *p2,
147 147
148void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, 148void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
149 StkId res, TMS event) { 149 StkId res, TMS event) {
150 if (!callbinTM(L, p1, p2, res, event)) { 150 if (l_unlikely(!callbinTM(L, p1, p2, res, event))) {
151 switch (event) { 151 switch (event) {
152 case TM_BAND: case TM_BOR: case TM_BXOR: 152 case TM_BAND: case TM_BOR: case TM_BXOR:
153 case TM_SHL: case TM_SHR: case TM_BNOT: { 153 case TM_SHL: case TM_SHR: case TM_BNOT: {
@@ -166,7 +166,8 @@ void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2,
166 166
167void luaT_tryconcatTM (lua_State *L) { 167void luaT_tryconcatTM (lua_State *L) {
168 StkId top = L->top; 168 StkId top = L->top;
169 if (!callbinTM(L, s2v(top - 2), s2v(top - 1), top - 2, TM_CONCAT)) 169 if (l_unlikely(!callbinTM(L, s2v(top - 2), s2v(top - 1), top - 2,
170 TM_CONCAT)))
170 luaG_concaterror(L, s2v(top - 2), s2v(top - 1)); 171 luaG_concaterror(L, s2v(top - 2), s2v(top - 1));
171} 172}
172 173