[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: config-file for a config-language: where the cat meet its tail ?!?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Sat, 14 Jul 2012 11:36:15 +0200
2012/7/14 <meino.cramer@gmx.de>:
>
> 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: <http://lua-users.org/wiki/SandBoxes>