Kartik K. Agaram
37b05c2957
https://www.lua.org/pil/28.3.html
...
a = array.new(1000)
for i=1,1000 do
a:set(i, 1/i)
end
print(a:get(10)) -- 0.1
2021-11-05 09:17:54 -07:00
Kartik K. Agaram
b4d86665b8
https://www.lua.org/pil/28.2.html
2021-11-05 08:54:19 -07:00
Kartik K. Agaram
f53ca6f804
confirmed that this is the same
...
And it seems simpler to me.
2021-11-05 08:31:43 -07:00
Kartik K. Agaram
712dc16b23
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.
2021-11-05 08:31:43 -07:00
Kartik K. Agaram
e35454c9a8
I don't yet understand the stack
2021-10-24 14:20:37 -07:00
Kartik K. Agaram
d8fcd648d7
ok, starting to make sense now
...
Putting together two resources:
https://lucasklassmann.com/blog/2019-02-02-how-to-embeddeding-lua-in-c/#exposing-a-simple-variable
https://www.lua.org/manual/5.3/manual.html , section 2.1, "Values and Types", particularly the description of light user data.
And lo, I see lua_pushlightuserdata in lapi.c
2021-10-24 10:32:22 -07:00
Kartik K. Agaram
4a0822929b
done reading lua_newstate
2021-10-24 10:08:15 -07:00
Kartik K. Agaram
e3b1ac2c83
mildly less confusing
2021-10-24 09:58:47 -07:00
Kartik K. Agaram
7b285449c3
back to making sense of lua_newstate
2021-10-24 09:57:19 -07:00
Kartik K. Agaram
4a28aace9a
get rid of userstate hooks
2021-10-24 09:52:07 -07:00
Kartik K. Agaram
67e4fb8c8e
get rid of fromstate/tostate
2021-10-24 09:46:56 -07:00
Kartik K. Agaram
a1d3225305
get rid of state_size
2021-10-24 09:39:30 -07:00
Kartik K. Agaram
a3c090ce09
get rid of LUAI_EXTRASPACE
...
Lua's power may come from extensibility, but the indirections are
currently in the way
2021-10-24 09:35:12 -07:00
Kartik K. Agaram
c80bafed74
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.
2021-10-24 09:23:54 -07:00
Kartik K. Agaram
36ef0c236e
a simple test "app": towers of hanoi
...
Currently it works with stock Lua and lcurses. Our job now is to build
in the bindings to make it work here.
2021-10-23 22:28:00 -07:00
Kartik K. Agaram
8d8580089f
print's newline now returns to column 0
...
At this point I'm done making this repo ncurses-ready. Remaining files
that allude to stdin/stdout/stderr:
lauxlib.c - unclear how these primitives should work; may kill them
ldblib.c - unclear what debug experience should be
liolib.c - might kill or simulate these
luac.c - let the compiler continue to be a terminal program
2021-10-22 21:22:27 -07:00
Kartik K. Agaram
05fa5124c2
drop lua_stdin_is_tty
...
luaconf.h now no longer refers to stdin/stdout/stderr.
2021-10-22 21:02:47 -07:00
Kartik K. Agaram
9792ac1e09
drop support for '-' filename
...
lua.c now no longer refers to stdin/stdout/stderr.
2021-10-22 21:00:26 -07:00
Kartik K. Agaram
1445cbc5b1
ncurses I/O in lua.c
...
Currently working:
> print(1)
1
> print(2)
2
Print's newline doesn't return to column 0 yet.
Ctrl-d no longer works. Ctrl-c exits cleanly.
2021-10-22 20:54:34 -07:00
Kartik K. Agaram
d92a484b91
kill lua_readline abstraction
2021-10-22 20:37:56 -07:00
Kartik K. Agaram
9eb951608b
purge notion of commandline history
2021-10-22 20:30:13 -07:00
Kartik K. Agaram
0ab2c77e6c
delete readline support
...
We're going to be using full-on ncurses.
2021-10-22 20:29:31 -07:00
Kartik K. Agaram
c03ee20559
clean up a few warnings with gcc 9.3.0
2021-10-22 19:25:59 -07:00
Kartik K. Agaram
74f8cd15bb
new fork of Lua 5.1
...
https://www.lua.org
2021-10-22 19:24:44 -07:00