creating missing properties on the fly: config.some.url = '...'
Lua
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
spec
.gitattributes
.travis.yml
LICENSE
README.md
autoprop.lua

README.md

automatic lua property tables

Build Status

a little excercise in creating missing table entries/properties automatically:

local autoprop = assert( require 'autoprop' )

local config = autoprop()

config.some.url = 'http://olivinelabs.com/busted'
config.some.number = 42
config.some.other.url = 'https://github.com/nrother/dynamiclua'

print(config.some.url, config.some.number, config.some.other.url)

http://olivinelabs.com/busted       42      https://github.com/nrother/dynamiclua

Other implementations: lua-users wiki: Automagic Tables