On Fri, 21 Jun 2024, at 15:50, 'Martin Eden' via lua-l wrote:
> Hi Thijs, nice docs layout!
Thx. but that is just plain old Ldoc.
>
> I'm surprised you've not abstracted ANSI text calls. I've done it in
> [1] for pstra() and in [2] for GotoXY() and GetScreenSize().
>
> ANSI codes is a can of worms actually.
LuaSystem does the interface part, or the primitives you can use to build your own if you like. It handles the C part, the stuff that cannot be done in Lua. Similar to luafilesystem, or luasocket if you like. This is mostly where the random numbers, time functions and listing environment variables come in.
All terminal code I've seen so far is Posix only. LuaSystem also supports terminals on Windows. Due to the completely different type of implementations it can unfortunately not be done "cross platform" like the rest, hence most functions are "per platform".
Especially the input part is hard, since Windows pretty much does everything thread-based, and hence is always blocking. Whereas Posix does it file-based, (optionally) non-blocking. So very hard to abstract away.
> No real sane standard and lot of
> ad hoc extensions. But anyway, encapsulating functionality you need
> is not hard and better than writing 'local move_left = "\27[1D"'
> in game code.
>
This can be done on top of LuaSystem.
regards
Thijs