uLua v3.1.0
A Lua Modding Framework for Unity.
uLua.LuaObject Class Reference

MonoBehaviour script exposed to Lua. You may use this class as a base for your API game objects. More...

Public Member Functions

void Expose ()
 Exposes the object to Lua. More...
 
DynValue InvokeLua (string functionName, params object[] args)
 Invokes a Lua callback function. More...
 
void Expose ()
 Exposes the object to Lua.
 

Properties

DynValue this[DynValue key] [get, set]
 Returns a dynamic value indexed by a dynamic value Key.
 
DynValue this[string key] [get, set]
 Returns a dynamic value indexed by a string key.
 
LuaObject LuaParent [get, set]
 Use to access/set the parent of an object.
 
MonoBehaviour Metatable [get, set]
 A component to use as the meta table of the object.
 
bool IsExposed [get]
 Tracks if an object has been exposed to Lua.
 
string LuaHandle [get]
 Returns a unique handle of a Lua object.
 
string LuaName [get, set]
 Use to access the name of an object.
 
bool EnableObjectScript [get, set]
 Indicates whether the object script is enabled for this object.
 
ExposeTarget ExposeTarget [get, set]
 Indicates when this object will be exposed to Lua.
 
- Properties inherited from uLua.Core.ILuaObject
DynValue this[DynValue key] [get, set]
 Returns a dynamic value indexed by a dynamic value Key. More...
 
DynValue this[string key] [get, set]
 Returns a dynamic value indexed by a string key. More...
 
LuaObject LuaParent [get, set]
 Use to access/set the parent of an object. More...
 
MonoBehaviour Metatable [get, set]
 A component to use as the meta table of the object.
 
bool IsExposed [get]
 Tracks if an object has been exposed to Lua. More...
 
string LuaHandle [get]
 Returns a unique handle of a Lua object.
 
string LuaName [get]
 Use to access the name of an object. More...
 

Detailed Description

MonoBehaviour script exposed to Lua. You may use this class as a base for your API game objects.

Instances of this class are exposed to Lua if configured. All public members of derived classes will be exposed to Lua. Prior to exposing an object of type uLua.LuaObject, the derived type T must be registered to Lua by calling API.RegisterIndexedType().

Member Function Documentation

◆ Expose()

void uLua.LuaObject.Expose ( )
inline

Exposes the object to Lua.

The property IsExposed can be used to check if this method has been called. The IsExposed flag cannot be reset.

Implements uLua.Core.ILuaObject.

◆ InvokeLua()

DynValue uLua.LuaObject.InvokeLua ( string  functionName,
params object[]  args 
)
inline

Invokes a Lua callback function.

The callback function must be implemented in a Lua script as a member of this object.

Parameters
functionNameThe name of the callback function to be called.
args(Optional) Parameters for the callback function.