Namespaces ...
More...
Go to the source code of this file.
|
function mod | get (name) |
| Get a namespace by its name creating it if necessary. More...
|
|
namespace | __index (key) |
| Retrieve a copy of a value in the namespace. More...
|
|
namespace | __newindex (key, val) |
| Store a value in the namespace. More...
|
|
namespace | forEach (func) |
| Iterate over all keys/values in a namespace Note: namespaces do not offer a 'normal' iterator (e.g. More...
|
|
Namespaces ...
- Todo:
- TODO docu
Definition in file namespaces.lua.
namespace __index |
( |
key |
| ) |
|
Retrieve a copy of a value in the namespace.
- Parameters
-
key | the key, must be a string |
namespace __newindex |
( |
key |
, |
|
|
val |
|
|
) |
| |
Store a value in the namespace.
- Parameters
-
key | the key, must be a string |
val | the value to store, will be serialized |
namespace forEach |
( |
func |
| ) |
|
Iterate over all keys/values in a namespace Note: namespaces do not offer a 'normal' iterator (e.g.
through a __pair metamethod) due to locking. Iterating over a table requires a lock on the whole table; ensuring that the lock is released is easier with a forEach method than with a regular iterator.
- Parameters
-
func | function to call, receives (key, value) as arguments |
function mod get |
( |
name |
| ) |
|
Get a namespace by its name creating it if necessary.
- Parameters
-
name | the name, defaults to an auto-generated string consisting of the caller's filename and line number |