uLua v2.2.0
A Lua Modding Framework for Unity.
uLua.ExposedMonoBehaviour Class Reference

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

Public Attributes

ExposeOn ExposeOn = ExposeOn.Start
 Indicates when this object will be exposed to Lua.
 
bool EnableObjectScript = false
 Indicates whether to execute a resource script for this object after it is exposed.
 

Protected Member Functions

virtual void Awake ()
 Exposes the game object to Lua if ExposeOn is set to 'Awake'. More...
 
virtual void OnExpose ()
 Scriptable method called when an object is exposed to Lua. More...
 
virtual void Start ()
 Exposes the game object to Lua if ExposeOn is set to 'Start'. More...
 
- Protected Member Functions inherited from uLua.LuaMonoBehaviour
virtual void OnDestroy ()
 Invokes the OnExit callback and removes the object from Lua. More...
 

Additional Inherited Members

- Public Member Functions inherited from uLua.LuaMonoBehaviour
void Expose ()
 Used to raise a flag when an object is exposed to Lua. More...
 
void InvokeLua (string FunctionName, params object[] args)
 Invokes a Lua callback function. More...
 
void Register (string FunctionName, string Code="", string args="")
 Registers a Lua callback function. This method is available in Lua. More...
 
- Properties inherited from uLua.LuaMonoBehaviour
DynValue this[DynValue Key] [get, set]
 Returns a Lua value indexed by the DynValue Key. More...
 
DynValue this[string Key] [get, set]
 Returns a Lua value indexed by the string key. More...
 
LuaMonoBehaviour Context [get, set]
 Used to access/set the context of an object. More...
 
string Handle [get]
 Used to access the unique Handle of a Lua object. More...
 
bool IsExposed [get]
 Used to track if an object has been exposed to Lua. More...
 
string Name [get, set]
 Used to access/set the name of an object. More...
 
- Properties inherited from uLua.ILuaObject
DynValue this[DynValue Key] [get, set]
 Returns a Lua value indexed by the DynValue Key. More...
 
DynValue this[string Key] [get, set]
 Returns a Lua value indexed by the string key. More...
 
LuaMonoBehaviour Context [get, set]
 Used to access/set the context of an object. More...
 
string Handle [get]
 Used to access the unique Handle of a Lua object. More...
 
bool IsExposed [get]
 Used to track if an object has been exposed to Lua. More...
 
string Name [get]
 Used to access the name of an object. More...
 

Detailed Description

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

Instances of this class are automatically exposed to Lua. All public members of derived classes will also be exposed to Lua. Inherits LuaMonoBehaviour.

Member Function Documentation

◆ Awake()

virtual void uLua.ExposedMonoBehaviour.Awake ( )
inlineprotectedvirtual

Exposes the game object to Lua if ExposeOn is set to 'Awake'.

The Context object must be set prior to this method being called. Objects will not be exposed to Lua if ExposeOn is set to None. If the object is exposed here, this method will also invoke an OnLoad callback and execute a resource script for the object if EnableObjectScript is set to true. This method is called by Unity Engine during game object initialisation.

◆ OnExpose()

virtual void uLua.ExposedMonoBehaviour.OnExpose ( )
inlineprotectedvirtual

Scriptable method called when an object is exposed to Lua.

Executes the object Lua script and invokes OnLoad by default.

◆ Start()

virtual void uLua.ExposedMonoBehaviour.Start ( )
inlineprotectedvirtual

Exposes the game object to Lua if ExposeOn is set to 'Start'.

The Context object must be set prior to this method being called. Objects will not be exposed to Lua if ExposeOn is set to None. If the object is exposed here, this method will also invoke an OnLoad callback and execute a resource script for the object if EnableObjectScript is set to true. Resource scripts are only executed for objects which are globals in Lua (i.e. Context is set to null). This method is called by Unity Engine during game object initialisation.