about summary refs log blame commit diff stats
path: root/src/notes
blob: ade61bf5ee0b6c9e0b75c390bf3e7133edd37531 (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

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



# T[k] = v

## Approach 1:
  -- initial { ... T ... }
  push k
  push v
  settable index(T)
  -- final { ... T ... }

## Approach 2 (if k is a string):
  push v
  setfield index(T), k