lua-users home
lua-l archive

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

2012/7/14  <>:

> currently I am writing a standalone lua application. This application
> needs a config file, which I want to implement as an hash
> table...something like this:
> profile={ SoC_a=( baudrate=115200,port="/dev/ttyS1"}}
> and put into an additional file in $HOME or equivalent.
> But how can I load it back into my application?
> The explanation of loadfile() says, that the code will be compiled
> and stored "for later execution". But my config file does not
> have anything to call or execute.
> How it becomes accessible from inside my application?
> What is the best lua-ish way to accomplish the handling of
> config files, which are valid lua code?

If you trust the code,

    dofile "config.lua"

If you don't trust it: <>