update runner docs and align tests

This commit is contained in:
2026-03-22 23:44:33 +08:00
parent 10bc402100
commit c16de88385
4 changed files with 22 additions and 14 deletions

View File

@ -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;
}
*/
*/