gmodproj >= 0.4.0
- moonscript - Via
require
for MoonScript-based property files. - lpeg (or a suitable polyfill such as LuLPeg) - Required for MoonScript-based property files.
A standalone platform-independent Lua library, facilitating encoding and decoding of Lua tables into human-readable properties files.
Currently missing a more readable form of documentation, although everything under the src
directory annotated.
Currently properities
only supports two encoding formats usable in encode(table value, table EncoderOptions?)
and decode(string value, table DecoderOptions?)
.
Supports encoding and decoding of Lua tables into human-readable Lua files
sample.lprop
tableProp = {
testProp = 'testValue'
}
main.lua
local properties = import 'novacbn/properties/exports'
local tableProp = properties.decode(..., {
propertiesEncoder = 'lua'
})
print(tableProp.testProp) -- prints 'testValue'
Supports encoding and decoding of Lua tables into human-readable MoonScript files.
sample.mprop
tableProp:
testProp: 'testValue'
main.lua
local properties = import 'novacbn/properties/exports'
local tableProp = properties.decode(..., {
propertiesEncoder = 'moonscript'
})
print(tableProp.testProp) -- prints 'testValue'
If wanting to use with a standard Lua platform, download the latest properties.lua
build from Releases. And use it as you would any other library.
Alternatively, if using with gmodproj
. Download the latest .zip
or .tar.gz
archive from the Releases. Extract the contents of src
directory into your project's packages
directory under a novacbn/properties
directory.
# Clone the repository
git clone https://github.com/novacbn/properties
# Move into the project and make the build directory
cd properties
mkdir ./dist
# Building the project will produce `./dist/properties.lua`
gmodproj build # Or gmodproj build production