diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-03-16 13:59:21 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-03-16 13:59:21 -0300 |
commit | 04bbd0117174911a489ca7d2603c1e8717565405 (patch) | |
tree | aa655728e84a47cf6a6929ab2c232edd691ff60e /lvm.c | |
parent | 9ffae705ee8894d68bbc07a1a5f77a112c40efad (diff) | |
download | lua-04bbd0117174911a489ca7d2603c1e8717565405.tar.gz lua-04bbd0117174911a489ca7d2603c1e8717565405.tar.bz2 lua-04bbd0117174911a489ca7d2603c1e8717565405.zip |
new operation *t (for size of t) (may yet be removed...)
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lvm.c,v 2.31 2005/03/08 20:10:05 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.32 2005/03/09 16:28:07 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 | */ |
@@ -562,6 +562,21 @@ StkId luaV_execute (lua_State *L, int nexeccalls) { | |||
562 | setbvalue(ra, res); | 562 | setbvalue(ra, res); |
563 | continue; | 563 | continue; |
564 | } | 564 | } |
565 | case OP_SIZ: { | ||
566 | const TValue *rb = RB(i); | ||
567 | switch (ttype(rb)) { | ||
568 | case LUA_TTABLE: | ||
569 | setnvalue(ra, cast(lua_Number, luaH_getn(hvalue(rb)))); | ||
570 | break; | ||
571 | case LUA_TSTRING: | ||
572 | setnvalue(ra, cast(lua_Number, tsvalue(rb)->len)); | ||
573 | break; | ||
574 | default: /* no metamethod?? */ | ||
575 | L->ci->savedpc = pc; | ||
576 | luaG_typeerror(L, rb, "get the size of"); | ||
577 | } | ||
578 | continue; | ||
579 | } | ||
565 | case OP_CONCAT: { | 580 | case OP_CONCAT: { |
566 | int b = GETARG_B(i); | 581 | int b = GETARG_B(i); |
567 | int c = GETARG_C(i); | 582 | int c = GETARG_C(i); |