Murl Engine Lua Addon API  Version 1.0 beta
Murl.Addons.Lua.IAddon

The Lua interpreter addon interface.

Adds a wide-ranging integration of the Murl framework to the Lua programming language, see http://www.lua.org/license.html


Table members

Inherited


Murl.IAddon

Methods


GetVersionNumber()

Get the Lua interpreter version information number.

Integer GetVersionNumber()

Returns
Integer The Lua interpreter version information number, e.g. 503.

GetVersion()

Get the Lua interpreter version information string.

String GetVersion()

Returns
String The Lua interpreter version information string, e.g. Lua 5.3.

GetRelease()

Get the Lua interpreter release information string.

String GetRelease()

Returns
String The Lua interpreter release information string, e.g. Lua 5.3.1.

GetCopyright()

Get the Lua interpreter copyright information string.

String GetCopyright()

Returns
String The Lua interpreter copyright information string.

GetAuthors()

Get the Lua interpreter authors information string.

String GetAuthors()

Returns
String The Lua interpreter authors information string.

OpenLibrary(name)

Open a Lua standard library. Lua offers the following standard libraries:

  • "bit32" Bitwise Operations
  • "math" Mathematical Functions
  • "string" String Manipulation
  • "table" Table Manipulation
  • "coroutine" Coroutine Manipulation
  • "debug" Debug Library
  • "package" Modules
  • "io" Input and Output Facilities, may not work on mobile devices, use Murl.IFileInterface instead
  • "os" Operating System Facilities, may not work on mobile devices, use Murl.System instead

The Lua Basic Functions library is opened automatically at addon's Init().

Boolean OpenLibrary(String name)

Parameters
nameThe name of the Lua standard library to open.
Returns
Boolean true if successful.

ReadChunk(fileInterface, fileName)

Read a Lua chunk from a file.

String ReadChunk(Murl.IFileInterface fileInterface, String fileName)

Parameters
fileInterfaceThe file interface.
fileNameThe name of the file to load.
Returns
String A string containing the Lua chunk or an empty string case of any error.

ReadResourceChunk(resourceCollection, resourceId)

Read a Lua chunk from a resource.

String ReadResourceChunk(Murl.Resource.ICollection resourceCollection, String resourceId)

Parameters
resourceCollectionThe resource collection.
resourceIdThe identifier of the resoure.
Returns
String A string containing the Lua chunk or an empty string case of any error.

LoadChunk(fileInterface, fileName)

Load (or map) a Lua chunk from a file. The loaded data must be unloaded by UnLoadChunk().

Murl.ConstData LoadChunk(Murl.IFileInterface fileInterface, String fileName)

Parameters
fileInterfaceThe file interface.
fileNameThe name of the file to load.
Returns
Murl.ConstData A data object containing the Lua chunk, the data object is empty in case of any error.

UnLoadChunk(fileInterface, chunk)

Unload (or unmap) a Lua chunk from a file.

Boolean, Murl.ConstData UnLoadChunk(Murl.IFileInterface fileInterface, Murl.ConstData chunk)

Parameters
fileInterfaceThe file interface.
chunkThe chunk data object to unload.
Returns
Boolean true if successful.
Murl.ConstData chunk The chunk data object to unload.

LoadResourceChunk(resourceCollection, resourceId)

Load (or map) a Lua chunk from a resource. The loaded data must be unloaded by UnLoadResourceChunk().

Murl.ConstData LoadResourceChunk(Murl.Resource.ICollection resourceCollection, String resourceId)

Parameters
resourceCollectionThe resource collection.
resourceIdThe identifier of the resoure.
Returns
Murl.ConstData A data object containing the Lua chunk, the data object is empty in case of any error.

UnLoadResourceChunk(resourceCollection, resourceId)

Unload (or unmap) a Lua chunk from a resource.

Boolean UnLoadResourceChunk(Murl.Resource.ICollection resourceCollection, String resourceId)

Parameters
resourceCollectionThe resource collection.
resourceIdThe identifier of the resoure.
Returns
Boolean true if successful.

ValidateChunk(chunk, chunkName, result)

Validate a Lua chunk data object.

Boolean, Murl.Result ValidateChunk(Murl.ConstData chunk, String chunkName, Murl.Result result)

Parameters
chunkThe Lua chunk data object to validate.
chunkNameThe name of the chunk used for error messages.
resultThis return value is set for syntactic script errors.
Returns
Boolean true if successful, false if the chunk is empty or a syntactic error occured.
Murl.Result result This return value is set for syntactic script errors.

CompileChunk(chunk, chunkName, stripDebugInfo)

Compile a Lua chunk data object. Warning! Compiled chunks are architecture dependent, e.g. chunks compiled on a 64 bit system are incompatible with 32 bit systems.

Murl.Data CompileChunk(Murl.ConstData chunk, String chunkName, Boolean stripDebugInfo)

Parameters
chunkThe Lua chunk data object to compile.
chunkNameThe name of the chunk used for error messages.
stripDebugInfoCreate without debug information about the function if true.
Returns
Murl.Data The compiled chunk data, the data object is empty in case of any error.

CreateIApp(chunk, chunkName)

Create an IApp interface object from a chunk. The Lua script gets the chunkName as parameter. The Lua script must return an IAppPtr instance.

Murl.SharedPointer.IApp CreateIApp(Murl.ConstData chunk, String chunkName)

Parameters
chunkThe Lua chunk data object to execute.
chunkNameThe name of the chunk used for error messages.
Returns
Murl.SharedPointer.IApp The IApp interface or null in case of any error.

CreateIAppProcessor(chunk, resourceId, info)

Create a Logic::IAppProcessor interface object from a chunk. The Lua script gets the resourceId and the info as parameter. The Lua script return an Logic::IAppProcessorPtr instance.

Murl.SharedPointer.LogicIAppProcessor CreateIAppProcessor(Murl.ConstData chunk, String resourceId, String info)

Parameters
chunkThe Lua chunk data object to execute.
resourceIdThe name of the chunk used for error messages.
infoA string with additional information passed to the script.
Returns
Murl.SharedPointer.LogicIAppProcessor The IApp interface or null in case of any error.

CreateIAppGraph(chunk, resourceId, info)

Create a Logic::IAppGraph interface object from a chunk. The Lua script gets the resourceId and the info as parameter. The Lua script must return an Logic::IAppGraphPtr instance.

Murl.SharedPointer.LogicIAppGraph CreateIAppGraph(Murl.ConstData chunk, String resourceId, String info)

Parameters
chunkThe Lua chunk data object to execute.
resourceIdThe name of the chunk used for error messages.
infoA string with additional information passed to the script.
Returns
Murl.SharedPointer.LogicIAppGraph The IApp interface or null in case of any error.

GetGlobal(value, table, key)

Get a Double value from a global Lua table. Preforms the Lua operation value = table[key].

Boolean, Number GetGlobal(Number value, String table, String key)

Parameters
valueReturn the value of table[key].
tableThe name of the table.
keyThe name of the key in the table to get the value from.
Returns
Boolean true if successful, false if the table or key does exists.
Number value Return the value of table[key].

GetGlobal(value, table, key)

Get a String value from a global Lua table. Preforms the Lua operation value = table[key].

Boolean, String GetGlobal(String value, String table, String key)

Parameters
valueReturn the value of table[key].
tableThe name of the table.
keyThe name of the key in the table to get the value from.
Returns
Boolean true if successful, false if the table or key does exists.
String value Return the value of table[key].

SetGlobal(table, key, value)

Set a Double value to a global Lua table. Preforms the Lua operation table[key] = value. If the table does not exist, a new table is created.

Boolean SetGlobal(String table, String key, Number value)

Parameters
tableThe name of the table.
keyThe name of the key in the table to set the value.
valueThe value to set table[key].
Returns
Boolean true if successful, false if the table-name exists in the global environment but is not type of a table.

SetGlobal(table, key, value)

Set a String value to a global Lua table. Preforms the Lua operation table[key] = value. If the table does not exist, a new table is created.

Boolean SetGlobal(String table, String key, String value)

Parameters
tableThe name of the table.
keyThe name of the key in the table to set the value.
valueThe value to set table[key].
Returns
Boolean true if successful, false if the table-name exists in the global environment but is not type of a table.

CollectGarbage()

Performs a full garbage-collection cycle.

Boolean CollectGarbage()

Returns
Boolean true if successful.