| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
|
| |
|
| |
|
|
|
|
| |
We'll eventually need some interface to add entries to it.
|
|
|
|
| |
The window only matters for output, which seems like a stupid interface.
|
|
|
|
|
| |
We're going to set aside a portion of the screen soon that apps can't
touch.
|
|
|
|
|
| |
Instead we'll include code in the Lua app itself, to minimize the
differences between what runs on regular Lua and what runs on Teliva.
|
|
|
|
|
| |
There's something strange in the combination of Lua 5.1 and lcurses:
window.getch() returns a char but curses.getch() returns an int.
|
| |
|
| |
|
|
|
|
|
| |
But how do we get curses.getch() to work?
I don't see it implemented in lcurses.
|
| |
|
|
|
|
|
|
|
| |
Very satisfying to debug the difference between lcurses putting the
module table in an upvalue. Since I implicitly call initstr() rather
than define it as a primitive, I don't need to bother with that. I am
awesome. Lua is awesome for giving me that sense.
|
| |
|
|
|
|
|
| |
I think we now have all the output functions/methods we need. Just some
constants remaining.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
I'm trying to follow the style of lua sources even when they're not my
preference. lcurses code is a bit different.
|
| |
|
|
|
|
|
|
|
|
| |
So why isn't this working?
a = curses:stdscr()
a:addstr(abc)
The error is "attempt to index global 'a' (a userdata value)"
|
|
|
|
|
| |
Makes no difference to the results of:
print(curses:stdscr())
|
| |
|
|
|
|
|
|
|
|
|
| |
Not quite working. curses.stdscr() is returning userdata, not a window.
This is true even of the raw array example from the book. So we need to
learn something new here. How does lcurses's Pinitscr return a special
window object? From what I can tell it's just putting the results of
lc_newwin() on the stack. Which is the same as my curses_newwin() here.
|
|
|
|
|
| |
print(curses.stdscr())
print(curses:stdscr())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
First piece of working new vocabulary:
print(curses:cols())
Just pulling in code from lcurses for the most part. But I'm trying to
understand its internals as I gradually add them in, after my more blunt
first approach of packaging up lcurses/ext failed.
Overall plan for Teliva's API:
- start out with a 'curses' library that does what people who are used
to ncurses/lcurses expect.
- over time create a more opinionated library called 'screen' or
'window' or something.
|
|
|
|
|
|
|
|
| |
a = array.new(1000)
for i=1,1000 do
a:set(i, 1/i)
end
print(a:get(10)) -- 0.1
|
| |
|
|
|
|
| |
And it seems simpler to me.
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Lua's power may come from extensibility, but the indirections are
currently in the way
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
| |
luaconf.h now no longer refers to stdin/stdout/stderr.
|
|
|
|
| |
lua.c now no longer refers to stdin/stdout/stderr.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
| |
We're going to be using full-on ncurses.
|
| |
|