From c80bafed747804da277a0f42d7c2f2a560505da1 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 24 Oct 2021 09:23:54 -0700 Subject: trying to make sense of how bindings are created lua_State contains these StkId fields (stack, stack_last, base, top) that expand to a pointer of a struct containing a Lua value and an int. Unclear how it's used, or how you build a stack out of it. --- src/lua.c | 2 +- src/lua.h | 2 -- src/luac.c | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lua.c b/src/lua.c index a6bbb2b..88cd29b 100644 --- a/src/lua.c +++ b/src/lua.c @@ -371,7 +371,7 @@ static int pmain (lua_State *L) { int main (int argc, char **argv) { int status; struct Smain s; - lua_State *L = lua_open(); /* create state */ + lua_State *L = luaL_newstate(); if (L == NULL) { l_message(argv[0], "cannot create state: not enough memory"); return EXIT_FAILURE; diff --git a/src/lua.h b/src/lua.h index a4b73e7..71bfbbf 100644 --- a/src/lua.h +++ b/src/lua.h @@ -284,8 +284,6 @@ LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); ** compatibility macros and functions */ -#define lua_open() luaL_newstate() - #define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX) #define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0) diff --git a/src/luac.c b/src/luac.c index d070173..fc4414a 100644 --- a/src/luac.c +++ b/src/luac.c @@ -190,7 +190,7 @@ int main(int argc, char* argv[]) int i=doargs(argc,argv); argc-=i; argv+=i; if (argc<=0) usage("no input files given"); - L=lua_open(); + L=luaL_newstate(); if (L==NULL) fatal("not enough memory for state"); s.argc=argc; s.argv=argv; -- cgit 1.4.1-2-gfad0