#include "tolua++.h"
Macros | |
#define | TOLUA_REFID_PTR_MAPPING "toluafix_refid_ptr_mapping" |
#define | TOLUA_REFID_TYPE_MAPPING "toluafix_refid_type_mapping" |
#define | TOLUA_REFID_FUNCTION_MAPPING "toluafix_refid_function_mapping" |
Functions | |
TOLUA_API int | NA. (lua_State *L, int uid, int *p_refid, void *ptr, const char *type) |
Push the userdata correspondings to the ptr on the top index of the Lua stack. More... | |
TOLUA_API int | NA. (lua_State *L, int refid) |
Find the value of Ref object pointer in the Lua registry by the refid. More... | |
TOLUA_API int | NA. (lua_State *L, int lo, int def) |
Get the refrence id of the Lua function at the given accepteable index lo of stack. More... | |
TOLUA_API void | NA. (lua_State *L, int refid) |
Push the Lua function found by the refid in the toluafix_refid_function_mapping table in the Lua registry on the top index of the current stack. More... | |
TOLUA_API void | NA. (lua_State *L, int refid) |
Remove the reference of the Lua function corresponding to the refid in the toluafix_refid_function_mapping table in the Lua registry. More... | |
TOLUA_API int | NA. (lua_State *L, int lo, const char *type, int def, tolua_Error *err) |
Verify the value at the given acceptable index is a function or not. More... | |
TOLUA_API int | NA. (lua_State *L, int lo, const char *type, int def, tolua_Error *err) |
Verify the value at the given acceptable index is a table or not. More... | |
TOLUA_API void | NA. (lua_State *L, const char *label) |
Print all information of the stack from the top index. More... | |
#define TOLUA_REFID_FUNCTION_MAPPING "toluafix_refid_function_mapping" |
var TOLUA_REFID_FUNCTION_MAPPING "toluafix_refid_function_mapping" |
local TOLUA_REFID_FUNCTION_MAPPING "toluafix_refid_function_mapping" |
#define TOLUA_REFID_PTR_MAPPING "toluafix_refid_ptr_mapping" |
local TOLUA_REFID_PTR_MAPPING "toluafix_refid_ptr_mapping" |
#define TOLUA_REFID_TYPE_MAPPING "toluafix_refid_type_mapping" |
TOLUA_API int toluafix_pushusertype_ccobject |
( | lua_State * | L, |
int | uid, | ||
int * | p_refid, | ||
void * | ptr, | ||
const char * | type | ||
) |
Push the userdata correspondings to the ptr on the top index of the Lua stack.
If the userdata correspondings to the ptr don't exist, it would call lua_newuserdata to new a userdata. If the userdata correspondings to the ptr exist,it would update the metatable information of the super. In addition, this function would update some table in the Lua registry,such as toluafix_refid_ptr_mapping, toluafix_refid_type_mapping,tolua_value_root,and so on. Meanwhile, Add a refrence about the userdata corresponding to the ptr in the tolua_ubox table. The ptr should be point to a Ref object.
L | the current lua_State. |
uid | the object id of the ptr. |
p_refid | the pointer points to the Lua reference id of the ptr. |
ptr | the pointer points to the Ref object. |
type | the type name of the ptr. |
var toluafix_pushusertype_ccobject | ( | var | L, |
var | uid, | ||
var | p_refid, | ||
var | ptr, | ||
var | type | ||
) |
Push the userdata correspondings to the ptr on the top index of the Lua stack.
If the userdata correspondings to the ptr don't exist, it would call lua_newuserdata to new a userdata. If the userdata correspondings to the ptr exist,it would update the metatable information of the super. In addition, this function would update some table in the Lua registry,such as toluafix_refid_ptr_mapping, toluafix_refid_type_mapping,tolua_value_root,and so on. Meanwhile, Add a refrence about the userdata corresponding to the ptr in the tolua_ubox table. The ptr should be point to a Ref object.
L | the current lua_State. |
uid | the object id of the ptr. |
p_refid | the pointer points to the Lua reference id of the ptr. |
ptr | the pointer points to the Ref object. |
type | the type name of the ptr. |
local toluafix_pushusertype_ccobject |
( | local | L, |
local | uid, | ||
local | p_refid, | ||
local | ptr, | ||
local | type | ||
) |
Push the userdata correspondings to the ptr on the top index of the Lua stack.
If the userdata correspondings to the ptr don't exist, it would call lua_newuserdata to new a userdata. If the userdata correspondings to the ptr exist,it would update the metatable information of the super. In addition, this function would update some table in the Lua registry,such as toluafix_refid_ptr_mapping, toluafix_refid_type_mapping,tolua_value_root,and so on. Meanwhile, Add a refrence about the userdata corresponding to the ptr in the tolua_ubox table. The ptr should be point to a Ref object.
L | the current lua_State. |
uid | the object id of the ptr. |
p_refid | the pointer points to the Lua reference id of the ptr. |
ptr | the pointer points to the Ref object. |
type | the type name of the ptr. |
TOLUA_API int toluafix_remove_ccobject_by_refid |
( | lua_State * | L, |
int | refid | ||
) |
Find the value of Ref object pointer in the Lua registry by the refid.
Then, remove the corresponding refrence in some table in the Lua registry by refid, such as toluafix_refid_type_mapping, toluafix_refid_ptr_mapping,tolua_value_root,and so on. Set the value of userdata nullptr and remove the refrence of userdata in the tolua_ubox table. This function is called in the destructor of the Ref automatically.
L | the current lua_State. |
refid | the value of the _luaID of a Ref object. |
TOLUA_API int toluafix_ref_function | ( | lua_State * | L, |
int | lo, | ||
int | def | ||
) |
Get the refrence id of the Lua function at the given accepteable index lo of stack.
Meanwhile add refrence about the Lua function through the toluafix_refid_function_mapping table in the Lua registry.
L | the current lua_State. |
lo | the given accepteable index lo of stack. |
def | useless. |
TOLUA_API void toluafix_get_function_by_refid |
( | lua_State * | L, |
int | refid | ||
) |
Push the Lua function found by the refid in the toluafix_refid_function_mapping table in the Lua registry on the top index of the current stack.
L | the current lua_State. |
refid | referenc id corresponding to the Lua function. |
var toluafix_get_function_by_refid | ( | var | L, |
var | refid | ||
) |
Push the Lua function found by the refid in the toluafix_refid_function_mapping table in the Lua registry on the top index of the current stack.
L | the current lua_State. |
refid | referenc id corresponding to the Lua function. |
local toluafix_get_function_by_refid |
( | local | L, |
local | refid | ||
) |
Push the Lua function found by the refid in the toluafix_refid_function_mapping table in the Lua registry on the top index of the current stack.
L | the current lua_State. |
refid | referenc id corresponding to the Lua function. |
TOLUA_API void toluafix_remove_function_by_refid |
( | lua_State * | L, |
int | refid | ||
) |
Remove the reference of the Lua function corresponding to the refid in the toluafix_refid_function_mapping table in the Lua registry.
L | the current lua_State. |
refid | referenc id corresponding to the Lua function. |
var toluafix_remove_function_by_refid |
( | var | L, |
var | refid | ||
) |
Remove the reference of the Lua function corresponding to the refid in the toluafix_refid_function_mapping table in the Lua registry.
L | the current lua_State. |
refid | referenc id corresponding to the Lua function. |
local toluafix_remove_function_by_refid |
( | local | L, |
local | refid | ||
) |
Remove the reference of the Lua function corresponding to the refid in the toluafix_refid_function_mapping table in the Lua registry.
L | the current lua_State. |
refid | referenc id corresponding to the Lua function. |
TOLUA_API int toluafix_isfunction | ( | lua_State * | L, |
int | lo, | ||
const char * | type, | ||
int | def, | ||
tolua_Error * | err | ||
) |
Verify the value at the given acceptable index is a function or not.
L | the current lua_State. |
lo | the given accepteable index lo of stack. |
type | useless. |
def | useless. |
err | if triggger the error, record the error message to err. |
var toluafix_isfunction | ( | var | L, |
var | lo, | ||
var | type, | ||
var | def, | ||
var | err | ||
) |
Verify the value at the given acceptable index is a function or not.
L | the current lua_State. |
lo | the given accepteable index lo of stack. |
type | useless. |
def | useless. |
err | if triggger the error, record the error message to err. |
local toluafix_isfunction | ( | local | L, |
local | lo, | ||
local | type, | ||
local | def, | ||
local | err | ||
) |
Verify the value at the given acceptable index is a function or not.
L | the current lua_State. |
lo | the given accepteable index lo of stack. |
type | useless. |
def | useless. |
err | if triggger the error, record the error message to err. |
TOLUA_API int toluafix_istable | ( | lua_State * | L, |
int | lo, | ||
const char * | type, | ||
int | def, | ||
tolua_Error * | err | ||
) |
Verify the value at the given acceptable index is a table or not.
L | the current lua_State. |
lo | the given accepteable index lo of stack. |
type | useless. |
def | whether has the default value. |
err | if triggger the error, record the error message to err. |
var toluafix_istable | ( | var | L, |
var | lo, | ||
var | type, | ||
var | def, | ||
var | err | ||
) |
Verify the value at the given acceptable index is a table or not.
L | the current lua_State. |
lo | the given accepteable index lo of stack. |
type | useless. |
def | whether has the default value. |
err | if triggger the error, record the error message to err. |
local toluafix_istable | ( | local | L, |
local | lo, | ||
local | type, | ||
local | def, | ||
local | err | ||
) |
Verify the value at the given acceptable index is a table or not.
L | the current lua_State. |
lo | the given accepteable index lo of stack. |
type | useless. |
def | whether has the default value. |
err | if triggger the error, record the error message to err. |
TOLUA_API void toluafix_stack_dump | ( | lua_State * | L, |
const char * | label | ||
) |
Print all information of the stack from the top index.
If the type corresponding to the index of the stack is LUA_TSTRING, LUA_TBOOLEAN or LUA_TNUMBER, it would output the value of the index,otherwise output the type name of the index.
L | the current lua_State. |
label | the string pointer to define the label of the dump information. |
var toluafix_stack_dump | ( | var | L, |
var | label | ||
) |
Print all information of the stack from the top index.
If the type corresponding to the index of the stack is LUA_TSTRING, LUA_TBOOLEAN or LUA_TNUMBER, it would output the value of the index,otherwise output the type name of the index.
L | the current lua_State. |
label | the string pointer to define the label of the dump information. |
local toluafix_stack_dump | ( | local | L, |
local | label | ||
) |
Print all information of the stack from the top index.
If the type corresponding to the index of the stack is LUA_TSTRING, LUA_TBOOLEAN or LUA_TNUMBER, it would output the value of the index,otherwise output the type name of the index.
L | the current lua_State. |
label | the string pointer to define the label of the dump information. |