| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- #ifndef __LUR_REG__
- #define __LUR_REG__
- #pragma once
- extern "C" {
- #include "lua.h"
- #include "lualib.h"
- #include "lauxlib.h"
- }
- #ifdef _DEBUG
- #pragma comment(lib,"lua5.3d.lib")
- #else
- #pragma comment(lib,"lua5.3.lib")
- #endif
- /************************************************************************/
- /* 函数:[1/15/2018 Jeff];
- /* 描述:;
- /* 参数:;
- /* [IN] :;
- /* [OUT] :;
- /* [IN/OUT] :;
- /* 返回:void;
- /* 注意:;
- /* 示例:;
- /*
- /* 修改:;
- /* 日期:;
- /* 内容:;
- /************************************************************************/
- int StackDump(lua_State* luaVM);
- int lua_create_aos(lua_State *luaVM);
- // 自动内存回收;
- int lua_auto_gc(lua_State *luaVM);
- //////////////////////////////////////////////////////////////////////////
- // 成员函数全局化,给lua脚本调用;
- int lua_InitClient(lua_State *luaVM);
- int lua_IsObjectUploaded(lua_State *luaVM);
- int lua_PutObjectFromFile(lua_State *luaVM);
- int lua_GetObject(lua_State *luaVM);
- int lua_DeleteObject(lua_State *luaVM);
- int lua_newArray();
- int lua_GetListAllObjects(lua_State *luaVM);
- //////////////////////////////////////////////////////////////////////////
- // 要注册lua中的全局成员函数;
- static const luaL_Reg g_member_funs[] = {
- { "__gc", lua_auto_gc },
- // { "new_array", lua_newArray},
- // { "set_array", NULL},
- // { "get_array", NULL },
- // { "size_array", NULL },
- { NULL, NULL }
- };
- // 要注册到lua中的全局构造函数;
- static const luaL_Reg g_constructor_funs[] = {
- { "create", lua_create_aos },
- { NULL, NULL }
- };
- // 将函数注册到lua环境中;
- int lua_regFuns(lua_State *luaVM);
- // 要注册的lua中的模块;
- static const luaL_Reg g_libs[] = {
- { "io", luaopen_io },
- { "os", luaopen_os },
- { "debug", luaopen_debug },
- { "string", luaopen_string },
- { "base", luaopen_base },
- { "math", luaopen_math },
- { "package", luaopen_package },
- // 以上属于lua系统模块;
- // 以下属于用户自定义模块;
- { "aos", lua_regFuns },
- { NULL, NULL }
- };
- // 将模块注册到lua环境中;
- void lua_regLibs(lua_State *luaVM);
- int lua_new();
- #endif
|