new macro lua_userstateopen

This commit is contained in:
Roberto Ierusalimschy
2002-01-09 19:51:06 -02:00
parent b3bb0f132b
commit ea2a75d19e
2 changed files with 11 additions and 3 deletions

View File

@@ -254,6 +254,13 @@ static int hash_query (lua_State *L) {
}
static int Cstacklevel (lua_State *L) {
unsigned long a = 0;
lua_pushnumber(L, (unsigned long)&a);
return 1;
}
static int table_query (lua_State *L) {
const Table *t;
int i = luaL_opt_int(L, 2, -1);
@@ -368,7 +375,6 @@ static int udataval (lua_State *L) {
static int doonnewstack (lua_State *L) {
lua_State *L1 = lua_newthread(L, luaL_check_int(L, 1));
if (L1 == NULL) return 0;
*cast(int **, L1) = &islocked; /* initialize the lock */
lua_dostring(L1, luaL_check_string(L, 2));
lua_pushnumber(L, 1);
lua_close(L1);
@@ -624,6 +630,7 @@ static const struct luaL_reg tests_funcs[] = {
{"listk", listk},
{"listlocals", listlocals},
{"loadlib", loadlib},
{"Cstacklevel", Cstacklevel},
{"querystr", string_query},
{"querytab", table_query},
{"testC", testC},