aboutsummaryrefslogtreecommitdiff
path: root/lvm.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-05-02 14:49:43 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-05-02 14:49:43 -0300
commit9b8d136e1cda86c6292105fb1e92d3b909ce1491 (patch)
tree8082b8b770cc617aa6c3e9c4f1876e2ff963e9d1 /lvm.c
parent9832f6b186be64423b73d9660e47ab2570a17a1b (diff)
downloadlua-9b8d136e1cda86c6292105fb1e92d3b909ce1491.tar.gz
lua-9b8d136e1cda86c6292105fb1e92d3b909ce1491.tar.bz2
lua-9b8d136e1cda86c6292105fb1e92d3b909ce1491.zip
`*' operator is primitive only for tables
Diffstat (limited to 'lvm.c')
-rw-r--r--lvm.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/lvm.c b/lvm.c
index 11de7913..3f6e82bb 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 2.37 2005/04/05 13:41:29 roberto Exp roberto $ 2** $Id: lvm.c,v 2.38 2005/04/11 18:01:29 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -527,9 +527,9 @@ StkId luaV_execute (lua_State *L, int nexeccalls) {
527 setnvalue(ra, luai_numunm(nb)); 527 setnvalue(ra, luai_numunm(nb));
528 } 528 }
529 else { 529 else {
530 setnilvalue(&temp); 530 rb = RB(i); /* `tonumber' erased `rb' */
531 if (!call_binTM(L, RB(i), &temp, ra, TM_UNM)) /***/ 531 if (!call_binTM(L, rb, &luaO_nilobject, ra, TM_UNM)) /***/
532 luaG_aritherror(L, RB(i), &temp); 532 luaG_aritherror(L, rb, &luaO_nilobject);
533 } 533 }
534 continue; 534 continue;
535 } 535 }
@@ -540,15 +540,12 @@ StkId luaV_execute (lua_State *L, int nexeccalls) {
540 } 540 }
541 case OP_SIZ: { 541 case OP_SIZ: {
542 const TValue *rb = RB(i); 542 const TValue *rb = RB(i);
543 switch (ttype(rb)) { 543 if (ttype(rb) == LUA_TTABLE) {
544 case LUA_TTABLE: 544 setnvalue(ra, cast(lua_Number, luaH_getn(hvalue(rb))));
545 setnvalue(ra, cast(lua_Number, luaH_getn(hvalue(rb)))); 545 }
546 break; 546 else { /* try metamethod */
547 case LUA_TSTRING: 547 if (!call_binTM(L, rb, &luaO_nilobject, ra, TM_SIZ)) /***/
548 setnvalue(ra, cast(lua_Number, tsvalue(rb)->len)); 548 luaG_typeerror(L, rb, "get size of");
549 break;
550 default: /* no metamethod?? */
551 luaG_typeerror(L, rb, "get the size of");
552 } 549 }
553 continue; 550 continue;
554 } 551 }