A few more tests for table access in the API

Added tests where the table being accessed is also the index or
value in the operation.
This commit is contained in:
Roberto Ierusalimschy
2019-06-25 17:38:58 -03:00
parent 05ba288049
commit 4487c28ced
2 changed files with 63 additions and 1 deletions

View File

@@ -1488,6 +1488,10 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) {
else if EQ("pushfstringP") {
lua_pushfstring(L1, lua_tostring(L, -2), lua_topointer(L, -1));
}
else if EQ("rawget") {
int t = getindex;
lua_rawget(L1, t);
}
else if EQ("rawgeti") {
int t = getindex;
lua_rawgeti(L1, t, getnum);
@@ -1496,6 +1500,14 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) {
int t = getindex;
lua_rawgetp(L1, t, cast_voidp(cast_sizet(getnum)));
}
else if EQ("rawset") {
int t = getindex;
lua_rawset(L1, t);
}
else if EQ("rawseti") {
int t = getindex;
lua_rawseti(L1, t, getnum);
}
else if EQ("rawsetp") {
int t = getindex;
lua_rawsetp(L1, t, cast_voidp(cast_sizet(getnum)));
@@ -1538,6 +1550,10 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) {
const char *s = getstring;
lua_setfield(L1, t, s);
}
else if EQ("seti") {
int t = getindex;
lua_seti(L1, t, getnum);
}
else if EQ("setglobal") {
const char *s = getstring;
lua_setglobal(L1, s);