[syslinux] Lua.c32 - user input / scripting

e h ehouston3 at yahoo.com
Thu May 12 06:11:59 PDT 2011


>>>On 05/11/2011 06:15 AM, e h wrote:
>>> I think the issue may be in "/lua/src/liolib.c" I saw a lot of commented out
>>> io_read and other read related functions.  I'm guessing they weren't working
>>> properly.

>>Reads should work... that's really odd.

 >>-hpa

Unless, I'm doing something wrong... I have a usb key formatted with syslinux-4.04. 

a section of my syslinux.cfg:

LABEL Lenovo_Lua
    MENU LABEL Lenovo Lua Script
    KERNEL LUA.C32
      APPEND /lua/test/table.lua

LABEL LUA
      MENU LABEL  Lua
    COM32 LUA.C32
-----------------------------------------
Whether I load just the LUA.C32 interpreter or if I load it with a script ("table.lua") or my own ("lenovo.lua") the read portions of the scripts error out.

---start of Table.lua:- /lua/test/table.lua -------

-- make table, grouping all data for the same item
-- input is 2 columns (item, data)

local A
while 1 do
 local l=io.read()
 if l==nil then break end
 local _,_,a,b=string.find(l,'"?([_%w]+)"?%s*(.*)$')
 if a~=A then A=a io.write("\n",a,":") end
 io.write(" ",b)
end
io.write("\n")
---------end of  table.lua file ------

-----start of Lenovo.lua -  /lenovo/lenovo.lua ----
print("Enter the 4-digit Machine Type :")
mt=io.read()
print ("you Entered "..mt)

------end of file ------

When run inside my vm with the Lua interpreter installed i get the following output:
---start of output----
Please Enter the 4-digit Machine Type:
4848
You Entered 4848
---end of output----

When run with the usb key using the Lua.c32 module i get the following output:
---start of output----
Enter the 4-digit machine type :
LUA.C32: /lenovo/lenovo.lua:2: attempt to call field 'read' (a nil value)
stack traceback:
/lenovo/lenovo.lua:2: in main chunk
[C]: ?
boot:
---- end of output-----
--- table.lua output using lua.c32 on usbkey----
lua.c32: /lua/test/table.lua:6: attempt to call field 'read' (a nil value)
stack traceback:
/lua/test/table.lua:6: in main chunk
[C]: ?
boot:
---end of table.lua output---


Thanks for the responses,
ps..forgive me if the posting format is wrong, trying...
EH





More information about the Syslinux mailing list