[syslinux] Lua.c32 wiki page

Dag Wieers dag at wieers.com
Mon Aug 9 14:37:35 PDT 2010


On Mon, 9 Aug 2010, Marcel Ritter wrote:

>  Am 09.08.2010 18:25, schrieb Dag Wieers:
>>  Hi,
>>
>>  I have been experimenting a bit with lua.c32 and I have created a small
>>  lua.c32 wiki page at:
>>
>>      http://syslinux.zytor.com/wiki/index.php/Lua.c32
>>
>>  With my minimal knowledge about Lua (and the inconvenience of not being
>>  able to copy&paste or edit scripts) I discovered that the dmi module has 2
>>  functions (supported, gettable) and a syslinux module with 1 function
>>  (run_command).
>
> Did you take a look at com32/lua/doc/syslinux.asc?
> I tried to document the (very basic) functions calls there, including
> some examples.

Well, I only found that out after I discovered that I was using 4.01 and 
not 4.02 :-) I did import your examples into the wiki, I hope that is ok 
with you ? The examples make it very obvious how to use lua.c32 so I hope 
this will creation some traction within the community.


>>  Do we have some information available about these functions ? And what is
>>  planned for Lua in the future, I haven't seen this discussed here ?
>>
>>  What could be useful is:
>>
>>   - a way to find the boot-method (and device/name) (syslinux.bootloader,
>>     syslinux.bootdevice)
>>
>>   - a way to query syslinux information (syslinux.version, syslinux.api)
>>
>>   - a way to provide syslinux a generated .cfg (syslinux.load())
>>
>>   - a way to query for pci device (and match pci.ids or modules.list)
>>
>>   - a way to query other hardware info
>>
>>   - an implementation of the os module, now one cannot exit lacking
>>     os.exit()
>>
>>  - the dmi module could export its information as module variables, rather
>>     than a function that exports a table
>
> If someone can point me to the corresponding com32 code, I'll do my best
> to add some more lua bindings - but this could take some time, due to the
> lack of spare time, sorry.

Some of the above is already possible with 4.02. Sorry for the 
confusion.

On the other hand the usage of some of the functions and the lack of 
consistency of the function names, make me realize we can do a better job 
before people start to rely on it.

I would propose to:

  - change functions that return a fixed value and do not require arguments
    into values (avoid the function-call)
      eg. syslinux.version vs syslinux.version()

  - change functions that return a table and not require arguments into
    real tables (avoid the extra assignment and function-call)
      eg. dmi.table vs dmi.gettable()

  - make functions more consistent, now some use underscores (local_boot,
    run_kernel, load_background) vs no underscores (loadfile, getmodes())

  - some functionality does not seem syslinux specific (filename, filesize)

  - some functions can be merged (sleep, msleep)

  - some functions have questionable (confusing?) names (boot_it,
    boot_linux, run_command, run_kernel_image)

If we want to do it right, now is the time.

-- 
--   dag wieers,  dag at wieers.com,  http://dag.wieers.com/   --
[Any errors in spelling, tact or fact are transmission errors]




More information about the Syslinux mailing list