U3D
Open-source, cross-platform 2D and 3D game engine built in C++
Loading...
Searching...
No Matches
Urho3D::LuaFunction Class Reference

C++ representation of Lua function object. More...

#include </var/dev/u3d/stable/Source/Urho3D/LuaScript/LuaFunction.h>

Inheritance diagram for Urho3D::LuaFunction:
[legend]
Collaboration diagram for Urho3D::LuaFunction:
[legend]

Public Member Functions

 LuaFunction (lua_State *L, int index)
 Construct from a Lua function object at the specified stack index.
 
 LuaFunction (lua_State *L, lua_CFunction func)
 Construct from a C function.
 
 ~LuaFunction () override
 Destruct.
 
bool IsValid () const
 Check that function is valid.
 
bool BeginCall (const LuaScriptInstance *instance=nullptr)
 Begin function call. When a script object is given then pass it as self argument (first parameter) to the function call.
 
bool EndCall (int numReturns=0)
 End call and actually execute the function. The return values, if any, are still left in the stack when this call returns.
 
void PushInt (int value)
 Push int to stack.
 
void PushBool (bool value)
 Push bool to stack.
 
void PushFloat (float value)
 Push float to stack.
 
void PushDouble (double value)
 Push double to stack.
 
void PushString (const String &string)
 Push string to stack.
 
void PushUserType (void *userType, const char *typeName)
 Push user type to stack.
 
template<typename T >
void PushUserType (const T *userType)
 Push user type to stack.
 
template<typename T >
void PushUserType (const T &userType)
 Push user type to stack.
 
template<typename T >
void PushUserType (const T *userType, const char *typeName)
 Push user type to stack.
 
template<typename T >
void PushUserType (const T &userType, const char *typeName)
 Push user type to stack.
 
void PushVariant (const Variant &variant, const char *asType=nullptr)
 Push variant to stack.
 
void PushLuaTable (const char *tableName)
 Push Lua table to stack. When the specified table is not found then a nil is pushed instead.
 
void PushLuaTable (const String &tableName)
 Push Lua table to stack. When the specified table is not found then a nil is pushed instead.
 
int GetFunctionRef () const
 Return function ref.
 
- Public Member Functions inherited from Urho3D::RefCounted
 RefCounted ()
 Construct. Allocate the reference count structure and set an initial self weak reference.
 
virtual ~RefCounted ()
 Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist.
 
 RefCounted (const RefCounted &rhs)=delete
 Prevent copy construction.
 
RefCountedoperator= (const RefCounted &rhs)=delete
 Prevent assignment.
 
void AddRef ()
 
void ReleaseRef ()
 
int Refs () const
 
int WeakRefs () const
 
RefCountRefCountPtr ()
 Return pointer to the reference count structure.
 

Private Attributes

lua_State * luaState_
 Lua state.
 
int numArguments_
 Number of arguments being pushed so far. For internal use only.
 
int functionRef_
 Lua reference to function object.
 

Detailed Description

C++ representation of Lua function object.


The documentation for this class was generated from the following files: