MoonGen
 All Files Functions Variables Pages
namespaces.lua File Reference

Namespaces ... More...

Go to the source code of this file.

Functions

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...
 

Detailed Description

Namespaces ...

Todo:
TODO docu

Definition in file namespaces.lua.

Function Documentation

namespace __index ( key  )

Retrieve a copy of a value in the namespace.

Parameters
keythe key, must be a string
namespace __newindex ( key  ,
val   
)

Store a value in the namespace.

Parameters
keythe key, must be a string
valthe 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
funcfunction to call, receives (key, value) as arguments
function mod get ( name  )

Get a namespace by its name creating it if necessary.

Parameters
namethe name, defaults to an auto-generated string consisting of the caller's filename and line number