4 ms·
Lua was written for exactly this purpose, and I personally enjoy writing with it, so it would be my first choice in most cases.
by isidor3 10y ago
Lua was written for exactly this purpose, and I personally enjoy writing with it, so it would be my first choice in most cases.
- petre 10y agoWhat purpose? Writing config files? Lua is a programming language (a nice one too). It's code. Code should not be used for config files, nor for data serialization because once you eval it you are executing it.
- isidor3 10y agoYes, Lua was originally written as a language for rich configuration files and has grown out of that into a more fully featured language. It's also one of the easier languages to sandbox, since you can evaluate user provided code in a custom environment that only contains the functions you deem safe. You can even use the standard debug hooks to set an upper limit on the number of instructions a script can execute to prevent someone from creating an infinite loop in a config file and locking whatever thread is reading the config. It's not very appropriate as a data serialization format, or as machine written config, but the parent post specifically asked about human written configuration files.