LuaState

Represents a Lua state instance.

Constructors

this
this()

Create a new, empty Lua state. The standard library is not loaded.

this
this(lua_State* L)

Create a D wrapper for an existing Lua state.

Destructor

~this
~this()
Undocumented in source.

Members

Functions

doFile
LuaObject[] doFile(char[] path, LuaErrorHandler handler)

Execute a file of Lua code.

doString
LuaObject[] doString(char[] code, LuaErrorHandler handler)

Execute a string of Lua _code.

get
T get(U args)

Same as calling globals._get with the same arguments.

loadFile
LuaFunction loadFile(char[] path)

Compile a file of Lua code.

loadString
LuaFunction loadString(char[] code)

Compile a string of Lua _code.

newTable
LuaTable newTable()

Create a new, empty table.

newTable
LuaTable newTable(uint narr, uint nrec)

Create a new, empty table with pre-allocated space for members.

newTable
LuaTable newTable(Range range)

Create a new table from an InputRange. If the element type of the range is Tuple!(T, U), then each element makes up a key-value pair, where T is the key and U is the value of the pair. For any other element type T, a table with sequential numeric keys is created (an array).

opIndex
LuaObject opIndex(T args)

Same as calling globals.get!LuaObject with the same arguments.

opIndexAssign
void opIndexAssign(T value, U args)

Same as calling globals._opIndexAssign with the same arguments.

openLibs
void openLibs()

Open the standard library.

registerType
LuaObject registerType()

Register a D class or struct with Lua.

set
void set(T key, U value)

Same as calling globals._set with the same arguments.

setPanicHandler
void setPanicHandler(void function(LuaState, in char[]) onPanic)

Set a new panic handler.

wrap
T wrap(U value)

Wrap a D value in a Lua reference.

Properties

globals
LuaTable globals [@property getter]

The global table for this instance.

registry
LuaTable registry [@property getter]

The registry table for this instance.

state
lua_State* state [@property getter]

The underlying lua_State pointer for interfacing with C.

Static functions

fromPointer
LuaState fromPointer(lua_State* L)

Get the LuaState instance for a Lua state.

Meta