Skip to content
Scott Shillcock edited this page Aug 27, 2010 · 1 revision

The "Lua API Documentation":http://dmzdev.org/docs/dmz/dmzlua.html lists functions available in the Lua console.

Key Short Cuts

shift-L Open the Lua console control-enter Executes the current Lua code. control-k Gets the previous Lua code from the consoles history. control-j Gets the next Lua code from the consoles history.

The Lua console will save the command history from run to run.

Note: For Mac OS, use the command key in place of the control key.

Loading and Unloading Plugins with the Lua Console

To print a list of currently loaded plugins dmz.runtime.print_plugin_list ()

To get more detail about each plugin, invoke the function with the optional parameter set to true dmz.runtime.print_plugin_list (true)

The following will load a plugin. Only the Plugin Name is required. All three of the table fields in the second argument are optional. dmz.runtime.load_plugin ( "Plugin Name", { unique="Unique Name", scope="Scope Name", factory="Factory Name" } )

A Plugin may be unloaded with the following call. The function will take either a plugin name or its handle. dmz.runtime.unload_plugin ("Plugin Name") or dmz.runtime.unload_plugin (handle)

A Plugin may be reloaded with the following call. The call unloads and then reloads the same plugin with the same initialization parameters. dmz.runtime.reload_plugin ("Plugin Name") or dmz.runtime.reload_plugin (handle)

Creating an Object with the Lua Console

Create the object and store its handle in the variable name handle handle = dmz.object.create ("blue_buggy")

Activate the object. dmz.object.activate (handle)

The object's state may be updated dmz.object.state (handle, nil, "Dead")

To unset the object's state dmz.object.state (handle, nil, "")

To set multiple states dmz.object.state (handle, nil, "Dead | Engine_On")

To set the objects position dmz.object.position (handle, nil, {10, 0, 10})

To destroy the object dmz.object.destroy (handle) handle = nil

Clone this wiki locally