public static int traceback(IntPtr L) { int arg; IntPtr L1; if (LuaDLL.lua_isthread(L, 1)) { arg = 1; L1 = LuaDLL.lua_tothread(L, 1); } else { arg = 0; L1 = L; } string msg = LuaDLL.lua_tostring(L, arg + 1); if (string.IsNullOrEmpty(msg)) { LuaDLL.lua_pushvalue(L, arg + 1); } else { int level = (int)LuaDLL.luaL_optinteger(L, arg + 2, (L == L1) ? 1 : 0); LuaDLL.lua_getref(L, 3); LuaDLL.lua_pushthread(L1); LuaDLL.lua_pushvalue(L, arg + 1); LuaDLL.lua_pushnumber(L, level + 1); LuaDLL.lua_call(L, 3, 1); } return(1); }
public IntPtr LuaToThread(int idx) { return(LuaDLL.lua_tothread(L, idx)); }