mirror of
https://github.com/lua/lua.git
synced 2025-02-04 06:13:04 +08:00
Details (in test library)
- Added support for negative stack indices in the "C interpreter" - Improved format when printing values
This commit is contained in:
parent
39a14ea7d7
commit
f7439112a5
21
ltests.c
21
ltests.c
@ -343,13 +343,19 @@ void lua_printvalue (TValue *v) {
|
||||
printf("%s", (!l_isfalse(v) ? "true" : "false"));
|
||||
break;
|
||||
}
|
||||
case LUA_TLIGHTUSERDATA: {
|
||||
printf("light udata: %p", pvalue(v));
|
||||
break;
|
||||
}
|
||||
case LUA_TNIL: {
|
||||
printf("nil");
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
void *p = iscollectable(v) ? gcvalue(v) : NULL;
|
||||
printf("%s: %p", ttypename(ttype(v)), p);
|
||||
if (ttislcf(v))
|
||||
printf("light C function: %p", fvalue(v));
|
||||
else /* must be collectable */
|
||||
printf("%s: %p", ttypename(ttype(v)), gcvalue(v));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1499,9 +1505,14 @@ static int getindex_aux (lua_State *L, lua_State *L1, const char **pc) {
|
||||
skip(pc);
|
||||
switch (*(*pc)++) {
|
||||
case 'R': return LUA_REGISTRYINDEX;
|
||||
case 'G': return luaL_error(L, "deprecated index 'G'");
|
||||
case 'U': return lua_upvalueindex(getnum_aux(L, L1, pc));
|
||||
default: (*pc)--; return getnum_aux(L, L1, pc);
|
||||
default: {
|
||||
int n;
|
||||
(*pc)--; /* to read again */
|
||||
n = getnum_aux(L, L1, pc);
|
||||
if (n == 0) return 0;
|
||||
else return lua_absindex(L1, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1550,7 +1561,7 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) {
|
||||
const char *inst = getstring;
|
||||
if EQ("") return 0;
|
||||
else if EQ("absindex") {
|
||||
lua_pushinteger(L1, lua_absindex(L1, getindex));
|
||||
lua_pushinteger(L1, getindex);
|
||||
}
|
||||
else if EQ("append") {
|
||||
int t = getindex;
|
||||
|
Loading…
x
Reference in New Issue
Block a user