mirror of
https://gitcode.com/JianFeeeee/LuaCangjia_api.git
synced 2026-09-20 17:08:12 +00:00
添加单元测试,修复部分错误
This commit is contained in:
@ -272,10 +272,10 @@ char *getresult(void *selfd){lua_runner*self =(lua_runner*) selfd;return self->r
|
||||
|
||||
|
||||
/// @brief 初始化lua解释器
|
||||
/// @param self lua_runner结构体指针
|
||||
/// @param pathio 重定向io目录
|
||||
/// @param pkgpath 用户包搜索目录
|
||||
/// @param funcs 重定向回调函数
|
||||
/// @param input 输入回调函数
|
||||
/// @param output 输出回调函数
|
||||
/// @return 0正常结束,-1异常退出
|
||||
void *init_lua_runner(const char *pathio,const char *pkgpath,int(*input)(),int(*output)())//该函数挂载到cj构造函数中执行
|
||||
{
|
||||
@ -299,17 +299,18 @@ void *init_lua_runner(const char *pathio,const char *pkgpath,int(*input)(),int(*
|
||||
errno = NAPI_LUA_STATE_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
//申请额外空间
|
||||
iopath *io_path = (iopath*)lua_getextraspace(L);
|
||||
//申请额外空间
|
||||
if(pathio == NULL)
|
||||
{
|
||||
goto WITHOUT_REDIRECT;
|
||||
}
|
||||
|
||||
if(io_path == NULL){
|
||||
errno = NAPI_ERROR_FUNCS;
|
||||
return NULL;
|
||||
}
|
||||
if(pathio == NULL)
|
||||
{
|
||||
errno = NAPI_LUA_MISS_REDIRECT;
|
||||
goto WITHOUT_REDIRECT;
|
||||
}
|
||||
|
||||
//装载重定向函数
|
||||
io_path->funcs.io_input = input;
|
||||
io_path->funcs.io_output = output;
|
||||
|
||||
Reference in New Issue
Block a user