themoos/core-moos — pull request #3 by ifreecarve (2013-07-30 19:24:08+00:00)
Title: Add support for configuration files written in lua

This patch 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