diff options
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -343,13 +343,19 @@ void lua_printvalue (TValue *v) { | |||
343 | printf("%s", (!l_isfalse(v) ? "true" : "false")); | 343 | printf("%s", (!l_isfalse(v) ? "true" : "false")); |
344 | break; | 344 | break; |
345 | } | 345 | } |
346 | case LUA_TLIGHTUSERDATA: { | ||
347 | printf("light udata: %p", pvalue(v)); | ||
348 | break; | ||
349 | } | ||
346 | case LUA_TNIL: { | 350 | case LUA_TNIL: { |
347 | printf("nil"); | 351 | printf("nil"); |
348 | break; | 352 | break; |
349 | } | 353 | } |
350 | default: { | 354 | default: { |
351 | void *p = iscollectable(v) ? gcvalue(v) : NULL; | 355 | if (ttislcf(v)) |
352 | printf("%s: %p", ttypename(ttype(v)), p); | 356 | printf("light C function: %p", fvalue(v)); |
357 | else /* must be collectable */ | ||
358 | printf("%s: %p", ttypename(ttype(v)), gcvalue(v)); | ||
353 | break; | 359 | break; |
354 | } | 360 | } |
355 | } | 361 | } |
@@ -1499,9 +1505,14 @@ static int getindex_aux (lua_State *L, lua_State *L1, const char **pc) { | |||
1499 | skip(pc); | 1505 | skip(pc); |
1500 | switch (*(*pc)++) { | 1506 | switch (*(*pc)++) { |
1501 | case 'R': return LUA_REGISTRYINDEX; | 1507 | case 'R': return LUA_REGISTRYINDEX; |
1502 | case 'G': return luaL_error(L, "deprecated index 'G'"); | ||
1503 | case 'U': return lua_upvalueindex(getnum_aux(L, L1, pc)); | 1508 | case 'U': return lua_upvalueindex(getnum_aux(L, L1, pc)); |
1504 | default: (*pc)--; return getnum_aux(L, L1, pc); | 1509 | default: { |
1510 | int n; | ||
1511 | (*pc)--; /* to read again */ | ||
1512 | n = getnum_aux(L, L1, pc); | ||
1513 | if (n == 0) return 0; | ||
1514 | else return lua_absindex(L1, n); | ||
1515 | } | ||
1505 | } | 1516 | } |
1506 | } | 1517 | } |
1507 | 1518 | ||
@@ -1550,7 +1561,7 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) { | |||
1550 | const char *inst = getstring; | 1561 | const char *inst = getstring; |
1551 | if EQ("") return 0; | 1562 | if EQ("") return 0; |
1552 | else if EQ("absindex") { | 1563 | else if EQ("absindex") { |
1553 | lua_pushinteger(L1, lua_absindex(L1, getindex)); | 1564 | lua_pushinteger(L1, getindex); |
1554 | } | 1565 | } |
1555 | else if EQ("append") { | 1566 | else if EQ("append") { |
1556 | int t = getindex; | 1567 | int t = getindex; |