about summary refs log tree commit diff stats
path: root/src/notes
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-04 04:08:59 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-11-05 08:31:43 -0700
commit712dc16b236fdb72a666ebe60b00adc1e5c1ef6e (patch)
treee49d7c91e4975593df85176ef0df6f76ca508594 /src/notes
parente35454c9a8e01637cc06f07586e58e470025f082 (diff)
downloadteliva-712dc16b236fdb72a666ebe60b00adc1e5c1ef6e.tar.gz
going through chapter 28 of https://www.lua.org/pil
User-defined C data.

I think I have some understanding of the Lua stack now. It's a different
kind of verbose, error-prone syntax than Mu that requires me to play
computer in my head. But I don't fully grok metatables yet. At least not
well enough to grok everything that's going on in lcurses/ext.
Diffstat (limited to 'src/notes')
-rw-r--r--src/notes15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/notes b/src/notes
index 3a87b2a..ade61bf 100644
--- a/src/notes
+++ b/src/notes
@@ -11,3 +11,18 @@ lua_State:
 
 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