LPCGame
A Simple 2d Game Engine
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
LuaC::UdataLib< T > Class Template Reference

#include <luacudata.h>

Static Public Member Functions

static T * Allocate (lua_State *l)
 
static void Push (lua_State *l, const T *obj)
 
static void Copy (lua_State *from, int idx, lua_State *too)
 
static T * Check (lua_State *l, int i)
 

Detailed Description

template<class T>
class LuaC::UdataLib< T >

A base template class for inherting methods for performing udata memory operations on Lua states

Member Function Documentation

template<class T>
static T* LuaC::UdataLib< T >::Allocate ( lua_State *  l)
inlinestatic

Allocate memory for an instance of T in the Lua state, initialize it, assign the appropriate metatable and return a pointer to the object

Parameters
lThe Lua state to make the object in
Returns
pointer to the allocated object
template<class T>
static T* LuaC::UdataLib< T >::Check ( lua_State *  l,
int  i 
)
inlinestatic

Check if the userdata at some index is of type T and return a pointer to it if it is

Parameters
lThe Lua state
iThe index of the userdata
template<class T>
static void LuaC::UdataLib< T >::Copy ( lua_State *  from,
int  idx,
lua_State *  too 
)
inlinestatic

Copy an object of type T from one Lua state at index i to another Lua state

Parameters
fromThe Lua state to copy from
idxThe index of the data in the from stack
tooThe Lua state to copy too
template<class T>
static void LuaC::UdataLib< T >::Push ( lua_State *  l,
const T *  obj 
)
inlinestatic

Push an object of type T onto the stack of the Lua state

Parameters
objThe object to push
lThe Lua state to push onto

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