lua_Object lua_createtable() { TObject o; luaC_checkGC(); avalue(&o) = luaH_new(0); ttype(&o) = LUA_T_ARRAY; return put_luaObject(&o); }
lua_Object lua_getref (int ref) { TObject *o = luaI_getref(ref); if (o == NULL) return LUA_NOOBJECT; return put_luaObject(o); }
/* ** API: creates a new table */ lua_Object lua_createtable (void) { TObject o; avalue(&o) = lua_createarray(0); ttype(&o) = LUA_T_ARRAY; return put_luaObject(&o); }
lua_Object lua_seterrormethod (void) { TObject temp = L->errorim; checkCparams(1); L->errorim = *(--L->stack.top); return put_luaObject(&temp); }
lua_Object lua_getlocal (lua_Function func, int local_number, char **name) { /* check whether func is a Lua function */ if (lua_tag(func) != LUA_T_PROTO) return LUA_NOOBJECT; else { TObject *f = Address(func); TProtoFunc *fp = luaA_protovalue(f)->value.tf; *name = luaF_getlocalname(fp, local_number, lua_currentline(func)); if (*name) { /* if "*name", there must be a LUA_T_LINE */ /* therefore, f+2 points to function base */ return put_luaObject((f+2)+(local_number-1)); } else return LUA_NOOBJECT; } }
lua_Object lua_rawgetglobal (char *name) { TaggedString *ts = luaS_new(name); return put_luaObject(&ts->u.s.globalval); }
lua_Object lua_gettagmethod (int tag, char *event) { return put_luaObject(luaT_gettagmethod(tag, event)); }
lua_Object lua_getref(int32 r) { TObject *o = luaC_getref(r); return (o ? put_luaObject(o) : LUA_NOOBJECT); }
lua_Object lua_seterrormethod() { TObject temp = errorim; checkCparams(1); errorim = *(--lua_state->stack.top); return put_luaObject(&temp); }
lua_Object lua_rawgetglobal (char *name) { return put_luaObject(&lua_table[luaI_findsymbolbyname(name)].object); }