diff options
author | Marek Vavruša <marek.vavrusa@nic.cz> | 2015-04-19 21:32:59 +0200 |
---|---|---|
committer | Marek Vavruša <marek.vavrusa@nic.cz> | 2015-04-19 21:32:59 +0200 |
commit | ae7b572dc19b3136562cc64cda67d30316e3be6f (patch) | |
tree | d549564d3e00d636ff6774320e5eecad18dcf06e /modules/README.rst | |
parent | lib/generic: missing include guard, updated doc (diff) | |
download | knot-resolver-ae7b572dc19b3136562cc64cda67d30316e3be6f.tar.xz knot-resolver-ae7b572dc19b3136562cc64cda67d30316e3be6f.zip |
daemon/engine: syntactic sugar for module ‘get’, ‘set’ properties
if the module declares such properties, they can be accessed
by treating module as a table, e.g.
hints[‘localhost’] = ‘127.0.0.1’
hints.hostname = ‘192.168.1.1.
print(hints.localhost)
equals to:
hints.set(‘localhost 127.0.0.1’)
hints.set(‘hostname 192.168.1.1’)
print(hints.get(‘localhost’))
Diffstat (limited to 'modules/README.rst')
-rw-r--r-- | modules/README.rst | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/README.rst b/modules/README.rst index 594cef46..e01236bf 100644 --- a/modules/README.rst +++ b/modules/README.rst @@ -247,6 +247,15 @@ Once you load the module, you can call the module property from the interactive *Note* |---| this relies on function pointers, so the same ``static inline`` trick as for the ``Layer()`` is required for C/Go. +Special properties +------------------ + +If the module declares properties ``get`` or ``set``, they can be used in the Lua interpreter as +regular tables. + +.. warning: This is not yet completely implemented, as the module I/O format may change to map_t a/o + embedded JSON tokenizer. + .. _`not present in Go`: http://blog.golang.org/gos-declaration-syntax .. _CGO: http://golang.org/cmd/cgo/ .. _GCCGO: https://golang.org/doc/install/gccgo |