mirror of
https://gitcode.com/JianFeeeee/LuaCangjia_api.git
synced 2026-09-22 09:58:10 +00:00
update runner docs and align tests
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
#define NAPI_UNLOADLIB_FAIL 5012 // 释放的库未被加载
|
||||
#define NAPI_LUAFUN_NOFOUND 5013 //调用不符合规定,没有遵守单入参单出参约定
|
||||
#define NAPI_LUA_STACK_ERROR 5014 //函数调用时,栈大小小于约定最小大小
|
||||
#define NAPI_LUA_INITFILE 5015 //lua状态机初始化错误
|
||||
#define NAPI_LUA_INITFAIL 5015 //lua状态机初始化错误
|
||||
#define NAPI_LUALIB_LOAD_OVER_STACK 5016 //加载太多lib
|
||||
#define NAPI_LUA_CLASS_LOST 5017 //luarunner对象丢失
|
||||
#define NAPI_LUA_MISS_REDIRECT 5018 //漏传用于重定向的文件路径
|
||||
|
||||
@ -170,7 +170,7 @@ int Lua_runner::run(const char *path,const char *arg)
|
||||
{
|
||||
if(!this->check_luastatue())//检查lua状态机状态
|
||||
return -1;
|
||||
|
||||
|
||||
if(path != NULL)//加载脚本到栈
|
||||
{
|
||||
if(this->load_lib(path,path) != 0)
|
||||
@ -180,12 +180,14 @@ int Lua_runner::run(const char *path,const char *arg)
|
||||
{
|
||||
lua_pushlstring(this->L,arg,strlen(arg));
|
||||
}
|
||||
if(this->pkg_cont<0)//检查是否有可调用chunk
|
||||
if(this->pkg_cont <= 0)//检查是否有可调用chunk
|
||||
{
|
||||
errno = NAPI_NOCHUNK_FOUND;
|
||||
return -1;
|
||||
}
|
||||
int argcount = lua_gettop(this->L) - this->pkgs[this->pkg_cont-1].ref;//获取入参数量
|
||||
int func_index = this->pkgs[this->pkg_cont-1].ref - 1;
|
||||
int top = lua_gettop(this->L);
|
||||
int argcount = top - func_index;//获取入参数量
|
||||
if(argcount<0)
|
||||
{
|
||||
errno = NAPI_LUA_STACK_ERROR;
|
||||
@ -213,4 +215,4 @@ int Lua_runner::callfunction()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user