Ejemplo n.º 1
0
lua_Object lua_gettagmethod (int tag, char *event)
{
  lua_pushnumber(tag);
  lua_pushstring(event);
  do_unprotectedrun(luaI_gettagmethod, 2, 1);
  return put_luaObjectonTop();
}
Ejemplo n.º 2
0
/*
** API: set a function as a fallback
*/
lua_Object lua_setfallback (char *name, lua_CFunction fallback)
{
  lua_pushstring(name);
  lua_pushcfunction(fallback);
  do_unprotectedrun(luaI_setfallback, 2, 1);
  return put_luaObjectonTop();
}
Ejemplo n.º 3
0
lua_Object lua_rawgettable (void) {
  checkCparams(2);
  if (ttype(L->stack.top-2) != LUA_T_ARRAY)
    lua_error("indexed expression not a table in rawgettable");
  *(L->stack.top-2) = *luaH_get(avalue(L->stack.top-2), L->stack.top-1);
  --L->stack.top;
  return put_luaObjectonTop();
}
Ejemplo n.º 4
0
lua_Object lua_settagmethod (int tag, char *event)
{
  TObject newmethod;
  checkCparams(1);
  newmethod = *(--top);
  lua_pushnumber(tag);
  lua_pushstring(event);
  *top = newmethod;  incr_top;
  do_unprotectedrun(luaI_settagmethod, 3, 1);
  return put_luaObjectonTop();
}
Ejemplo n.º 5
0
lua_Object lua_rawgettable() {
	checkCparams(2);
	if (ttype(lua_state->stack.top-2) != LUA_T_ARRAY) {
		lua_error("indexed expression not a table in rawgettable");
	} else {
		TObject *h = luaH_get(avalue(lua_state->stack.top - 2), lua_state->stack.top - 1);
		--lua_state->stack.top;
		if (h) {
			*(lua_state->stack.top-1) = *h;
		} else {
			ttype(lua_state->stack.top-1) = LUA_T_NIL;
		}
	}
	return put_luaObjectonTop();
}
Ejemplo n.º 6
0
lua_Object lua_rawgettable (void)
{
  checkCparams(2);
  if (ttype(top-2) != LUA_T_ARRAY)
    lua_error("indexed expression not a table in raw gettable");
  else {
    TObject *h = lua_hashget(avalue(top-2), top-1);
    --top;
    if (h != NULL)
      *(top-1) = *h;
    else
      ttype(top-1) = LUA_T_NIL;
  }
  return put_luaObjectonTop();
}
Ejemplo n.º 7
0
lua_Object lua_getglobal (char *name)
{
  luaD_checkstack(2);  /* may need that to call T.M. */
  luaV_getglobal(luaS_new(name));
  return put_luaObjectonTop();
}
Ejemplo n.º 8
0
lua_Object lua_gettable (void)
{
  checkCparams(2);
  luaV_gettable();
  return put_luaObjectonTop();
}
Ejemplo n.º 9
0
lua_Object lua_settagmethod (int tag, char *event)
{
  checkCparams(1);
  luaT_settagmethod(tag, event, L->stack.top-1);
  return put_luaObjectonTop();
}
Ejemplo n.º 10
0
lua_Object lua_pop (void) {
  checkCparams(1);
  return put_luaObjectonTop();
}
Ejemplo n.º 11
0
/*
** Get a global object.
*/
lua_Object lua_getglobal (char *name)
{
  getglobal(luaI_findsymbolbyname(name));
  return put_luaObjectonTop();
}
Ejemplo n.º 12
0
/* 
** API: receives on the stack the table and the index.
** returns the value.
*/
lua_Object lua_gettable (void)
{
  checkCparams(2);
  pushsubscript();
  return put_luaObjectonTop();
}
Ejemplo n.º 13
0
lua_Object lua_seterrormethod (void)
{
  checkCparams(1);
  do_unprotectedrun(luaI_seterrormethod, 1, 1);
  return put_luaObjectonTop();
}