themoos/core-moos — pull request #11 by ifreecarve (2013-10-23 20:16:51+00:00)
Title: Add support for configuration files written in Lua

This patch (against master, not devel) adds support for configuration files written in Lua, arguably a better way to represent configuration.

Example
------------

.moos Syntax:
```
ServerHost = localhost
ServerPort = 9000
// this is a comment
ProcessConfig = pLuaCfg
{
aString = MyStringValueNoSpaces
aSpacedString = S P A C E S

aDouble = 3.141

aBoolTrue = true
aBoolNotTrue = false

aMultiString = a
aMultiString = b
aMultiString = and so on

aNullVal =
}
```

Lua Syntax (same data)
```lua
ServerHost = "localhost"
ServerPort = 9000
-- this is a comment
pLuaCfg = {
aString = "MyStringValueNoSpaces",
aSpacedString = ("S P A C E S"):gsub(" ", ""),

aDouble = 3.141,

aBoolTrue = true,
aBoolNotTrue = false,

aMultiString = {
"a",
"b",
("and so on"):gsub(" ", ""), },

aNullVal = nil,
}
```

Backwards Compatibility
------------------------------------
Configuration files will be loaded into a Lua environment. If that fails (i.e., if they do not parse), then the file will be parsed as a normal .moos file.

Extras
---------
This code supples MOOSLuaEnvironment, which allows other uses of Lua files in MOOS. For example, as a Lua scripted MOOS App.

Slides here: http://oceanai.mit.edu/moos-dawg11/material/23-brief-katz.pdf