eris: add general purpose 'flag bits' to lua tables'
This commit is contained in:
@@ -898,6 +898,38 @@ LUA_API void lua_setuservalue (lua_State *L, int idx) {
|
||||
}
|
||||
|
||||
|
||||
LUA_API void lua_setflagbits (lua_State *L, int idx, unsigned char bits) {
|
||||
TValue *obj;
|
||||
Table *tab;
|
||||
lua_lock(L);
|
||||
obj = index2addr(L, idx);
|
||||
api_check(L, ttistable(obj), "table expected");
|
||||
tab = hvalue(obj);
|
||||
tab->flagbits = bits;
|
||||
lua_unlock(L);
|
||||
}
|
||||
|
||||
LUA_API void lua_modflagbits (lua_State *L, int idx, unsigned char set, unsigned char clear) {
|
||||
TValue *obj;
|
||||
Table *tab;
|
||||
lua_lock(L);
|
||||
obj = index2addr(L, idx);
|
||||
api_check(L, ttistable(obj), "table expected");
|
||||
tab = hvalue(obj);
|
||||
tab->flagbits |= set;
|
||||
tab->flagbits &= (~clear);
|
||||
lua_unlock(L);
|
||||
}
|
||||
|
||||
LUA_API unsigned char lua_getflagbits (lua_State *L, int idx) {
|
||||
TValue *obj;
|
||||
Table *tab;
|
||||
obj = index2addr(L, idx);
|
||||
api_check(L, ttistable(obj), "table expected");
|
||||
tab = hvalue(obj);
|
||||
return tab->flagbits;
|
||||
}
|
||||
|
||||
/*
|
||||
** `load' and `call' functions (run Lua code)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user