The current Lua.c32 does not enable io.read() due to some missing library functions...
authorHung-chi Lihn <hlihn@google.com>
Sat, 22 Sep 2012 16:22:55 +0000 (18:22 +0200)
committerErwan Velu <erwanaliasr1@gmail.com>
Sat, 22 Sep 2012 16:22:55 +0000 (18:22 +0200)
commita634ca1454ee70e115f0a0a319f3e02f273381e8
tree101408d2eafc5b180e35b9e94a95cc83ff152abc
parent76ade0c1c402048204614d7a6b1847f74e188626
The current Lua.c32 does not enable io.read() due to some missing library functions. However, this strongly limits the Lua script from getting user inputs and reading files (even in pxelinux via TFTP).

This patch enables io.read() in Lua.c32 with some restrictions:
  1. the io.read("*line") is fully supported.
  2. the io.read("*number") is not supported due to the missing buffering in underlying file I/Os. However, the user can read a line using io.read() and convert the string to numbers using the built in pattern matching and number conversion features.
  3. io.read(bytes) is supported. However, io.read(0) will not be a valid test for EOF due to the missing I/O buffering. io.read() will return nil if EOF is encountered. This offers an alternative way to handle EOF.

Signed-off-by: Hung-chi Lihn <hlihn@google.com>
Signed-off-by: Erwan Velu <erwanaliasr1@gmail.com>
com32/lua/src/liolib.c