Пример #1
0
int 
luaQ_pcall(lua_State *L, int na, int nr, int eh, int oh)
{
  QtLuaEngine *engine = luaQ_engine(L);
  QObject *obj = engine;
  if (oh)
    obj = luaQ_toqobject(L, oh);
  if (! obj)
    luaL_error(L, "invalid qobject");
  return luaQ_pcall(L, na, nr, eh, obj);
}
Пример #2
0
static int
qt_qcall(lua_State *L)
{
  QObject *obj = luaQ_checkqobject<QObject>(L, 1);
  luaL_checktype(L, 2, LUA_TFUNCTION);
  int base = 2;
  int narg = lua_gettop(L) - base;
  int status = luaQ_pcall(L, narg, LUA_MULTRET, 0, obj);
  lua_pushboolean(L, !status);
  lua_insert(L, base);
  return lua_gettop(L) - base + 1;
}
Пример #3
0
int 
QLuaApplication::Private::doCall(struct lua_State *L, int nargs)
{
  int status;
  int base = lua_gettop(L) - nargs;
  lua_pushcfunction(L, luaQ_traceback);
  lua_insert(L, base);
  status = luaQ_pcall(L, nargs, 0, base, theEngine);
  lua_remove(L, base);
  if (status)
    lua_gc(L, LUA_GCCOLLECT, 0);
  return status;
}
Пример #4
0
int 
QLuaApplication::Private::doCall(struct lua_State *L, int nargs)
{
  int status;
  int base = lua_gettop(L) - nargs;
  lua_pushcfunction(L, luaQ_traceback);
  lua_insert(L, base);
#if HAVE_SIGNAL_H
  signal(SIGINT, laction);
#endif
  status = luaQ_pcall(L, nargs, 0, base, theEngine);
#if HAVE_SIGNAL_H
  signal(SIGINT, SIG_DFL);
#endif
  lua_remove(L, base);
  if (status)
    lua_gc(L, LUA_GCCOLLECT, 0);
  return status;
}