[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: No ready way to store nil in array as pack does?
- From: Sean Conner <sean@...>
- Date: Sun, 12 Nov 2023 02:57:33 -0500
It was thus said that the Great Родион Горковенко once stated:
> Hi Friends!
Hi!
> Regard the case - I'm redefining io.read(...) - for example to allow
> 3-rd party code run in web-page (with Lua compiled to JS), requesting
> user to provide input data via pop-ups. To properly mock the original
> function behavior, I would like it to return "nil" sometimes (say upon
> reading number when
> no digits were provided).
I wrote a module to allow this type of thing---check out
https://github.com/spc476/lua-conmanorg/blob/master/lua/net/ios.lua
While the comments do mention TCP, it can be used for other things, like
strings, that might want to present a file-like interface to other Lua code.
As part of that, I reimplemented the code Lua uses to parse numbers (from C
into Lua). I did that to ensure the coded acted the same as Lua.
-spc