Skip to content
This repository has been archived by the owner on Jan 26, 2020. It is now read-only.
/ properties Public archive

A platform-independent properties encoder library for Lua projects

License

Notifications You must be signed in to change notification settings

novacbn/properties

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

properties

gmodproj >= 0.4.0

Requirements

  • moonscript - Via require for MoonScript-based property files.
  • lpeg (or a suitable polyfill such as LuLPeg) - Required for MoonScript-based property files.

Description

A standalone platform-independent Lua library, facilitating encoding and decoding of Lua tables into human-readable properties files.

Documentation

Currently missing a more readable form of documentation, although everything under the src directory annotated.

Properties Format

Currently properities only supports two encoding formats usable in encode(table value, table EncoderOptions?) and decode(string value, table DecoderOptions?).

EncoderOptions.propertiesEncoder == lua

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'

EncoderOptions.propertiesEncoder == moonscript

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'

Installation

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.

Building

# 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

About

A platform-independent properties encoder library for Lua projects

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published