lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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