Urho3D::LuaFunction Class Reference

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

#include <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.
 
virtual ~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.
 
void AddRef ()
 Increment reference count. Can also be called outside of a SharedPtr for traditional reference counting.
 
void ReleaseRef ()
 Decrement reference count and delete self if no more references. Can also be called outside of a SharedPtr for traditional reference counting.
 
int Refs () const
 Return reference count.
 
int WeakRefs () const
 Return weak reference count.
 
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:
  • Source/Urho3D/LuaScript/LuaFunction.h
  • Source/Urho3D/LuaScript/LuaFunction.cpp