about summary refs log blame commit diff stats
path: root/src/notes
blob: 6f609ff690ec41493b0e28d642843ebe87e60bf0 (plain) (tree)
1
2
3
4
5
6
7
8







                                                           






                                        
 
                                                                                                                          
// Main thread combines a thread state and the global state
typedef struct LG {
  lua_State l;
  global_State g;
} LG;

lua_State:
  &{Value; int tt} stack, stack_last, base, top
  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