about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lua.c3
-rw-r--r--src/notes6
2 files changed, 4 insertions, 5 deletions
diff --git a/src/lua.c b/src/lua.c
index 88cd29b..e40b61c 100644
--- a/src/lua.c
+++ b/src/lua.c
@@ -378,6 +378,9 @@ int main (int argc, char **argv) {
   }
   initscr();
   echo();
+  lua_pushinteger(L, 42);
+  lua_setfield(L, -1, "answer");
+//?   lua_setglobal(L, "answer");
   s.argc = argc;
   s.argv = argv;
   status = lua_cpcall(L, &pmain, &s);
diff --git a/src/notes b/src/notes
index 6f609ff..3a87b2a 100644
--- a/src/notes
+++ b/src/notes
@@ -9,9 +9,5 @@ lua_State:
   GCObject* next
   byte tt  # type == THREAD
 
-initializing a lua_State (lua_newstate)
-  allocate space (including for globals)
-  next = NULL
-  stack = NULL
-
 Lua's stack vs globals: https://lucasklassmann.com/blog/2019-02-02-how-to-embeddeding-lua-in-c/#exposing-a-simple-variable
+More info on the stack: https://www.lua.org/pil/24.2.html