Example #1
0
int luaT_optboolean(lua_State *L, int ud, int def)
{
  if(lua_isnoneornil(L,ud))
    return def;

  return luaT_checkboolean(L, ud);
}
Example #2
0
int luaT_optboolean(lua_State *L, int narg, int def)
{
  if(lua_isnoneornil(L,narg))
    return def;

  return luaT_checkboolean(L, narg);
}
Example #3
0
static int cutorch_setHeapTracking(lua_State *L)
{
  THCState *state = cutorch_getstate(L);
  int enabled = luaT_checkboolean(L,1);
  if(enabled) {
    THCSetGCHandler(state, luaCutorchGCFunction, L);
  } else {
    THCSetGCHandler(state, NULL, NULL);
  }
  return 0;
}
Example #4
0
File: utils.c Project: 10sun/torch7
static int torch_setheaptracking(lua_State *L)
{
  int enabled = luaT_checkboolean(L,1);
  lua_getglobal(L, "torch");
  lua_pushboolean(L, enabled);
  lua_setfield(L, -2, "_heaptracking");
  if(enabled) {
    THSetGCHandler(luaTorchGCFunction, L);
  } else {
    THSetGCHandler(NULL, NULL);
  }
  return 0;
}
Example #5
0
static int QPSolver_sumflag(lua_State *L)
{
  SVQP2 *qp = (SVQP2*)luaT_checkudata(L, 1, QPSolver_id);
  qp->sumflag = luaT_checkboolean(L, 2);
  return 0;
}