private int resume(object[] args, int oldTop) { int nArgs = 0; // Push args if (args != null) { nArgs = args.Length; for (int i = 0; i < args.Length; i++) { translator.push(L, args[i]); } } // Call func int r = 0; r = LuaDLL.lua_resume(L, nArgs); if (r > (int)LuaThreadStatus.LUA_YIELD) { // Error int top = LuaDLL.lua_gettop(L); ThrowExceptionFromError(top); } return(r); }
public int Resume(params object[] args) { objs = null; int top = 0; luaState.Push(this); IntPtr L = luaState.LuaToThread(-1); luaState.LuaPop(1); int nArgs = 0; if (args != null) { nArgs = args.Length; for (int i = 0; i < args.Length; i++) { ToLua.Push(L, args[i]); } } int ret = LuaDLL.lua_resume(L, nArgs); if (ret > (int)LuaThreadStatus.LUA_YIELD) { string error = null; top = LuaDLL.lua_gettop(L); LuaDLL.tolua_pushtraceback(L); LuaDLL.lua_pushthread(L); LuaDLL.lua_pushvalue(L, -3); if (LuaDLL.lua_pcall(L, 2, -1, 0) != 0) { LuaDLL.lua_settop(L, top); } error = LuaDLL.lua_tostring(L, -1); LuaDLL.lua_settop(L, 0); throw new LuaException(error); } top = LuaDLL.lua_gettop(L); if (top > 0) { objs = new object[top]; for (int i = 0; i < top; i++) { objs[i] = ToLua.ToVarObject(L, i + 1); } } if (ret == 0) { Dispose(); } return(ret); }
public int LuaResumeThread(IntPtr thread, int narg) { #if LUAC_5_3 return(LuaDLL.lua_resume(thread, L, narg)); #else return(LuaDLL.lua_resume(thread, narg)); #endif }
public int Resume(params object[] args) { this.objs = null; this.luaState.Push(this); IntPtr intPtr = this.luaState.LuaToThread(-1); this.luaState.LuaPop(1); int narg = 0; if (args != null) { narg = args.Length; for (int i = 0; i < args.Length; i++) { ToLua.Push(intPtr, args[i]); } } int num = LuaDLL.lua_resume(intPtr, narg); int num2; if (num > 1) { num2 = LuaDLL.lua_gettop(intPtr); LuaDLL.tolua_pushtraceback(intPtr); LuaDLL.lua_pushthread(intPtr); LuaDLL.lua_pushvalue(intPtr, -3); if (LuaDLL.lua_pcall(intPtr, 2, -1, 0) != 0) { LuaDLL.lua_settop(intPtr, num2); } string msg = LuaDLL.lua_tostring(intPtr, -1); LuaDLL.lua_settop(intPtr, 0); throw new LuaException(msg, null, 1); } num2 = LuaDLL.lua_gettop(intPtr); if (num2 > 0) { this.objs = new object[num2]; for (int j = 0; j < num2; j++) { this.objs[j] = ToLua.ToVarObject(intPtr, j + 1); } } if (num == 0) { this.Dispose(); } return(num); }
public int Resume(int narg) { int top = LuaDLL.lua_gettop(luaState); int ret = LuaDLL.lua_resume(luaState, narg); if (ret == 1 /*LUA_YIELD*/) { return(1); //yielded } if (ret == 0) { return(0); //normal termination } //error. throw exception with error message (TBD - debug api to get call stack) ThrowExceptionFromError(top); return(ret); }
protected int Resume(IntPtr L, int nArgs) { int ret = LuaDLL.lua_resume(L, nArgs); if (ret > (int)LuaThreadStatus.LUA_YIELD) { string error = null; int top = LuaDLL.lua_gettop(L); LuaDLL.tolua_pushtraceback(L); LuaDLL.lua_pushthread(L); LuaDLL.lua_pushvalue(L, top); if (LuaDLL.lua_pcall(L, 2, -1, 0) != 0) { LuaDLL.lua_settop(L, top); } error = LuaDLL.lua_tostring(L, -1); luaState.LuaSetTop(0); throw new LuaException(error); } return(ret); }
public int LuaResume(int narg) { return(LuaDLL.lua_resume(L, narg)); }