From 4052503093ddb56e2630530d001540dbe03270b6 Mon Sep 17 00:00:00 2001 From: Josh Yelon Date: Sun, 25 Jul 2021 20:34:57 -0400 Subject: [PATCH] Add accessors to view flag bits in lua --- luprex/core/cpp/table.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/luprex/core/cpp/table.cpp b/luprex/core/cpp/table.cpp index 07235b3f..9bfb2974 100644 --- a/luprex/core/cpp/table.cpp +++ b/luprex/core/cpp/table.cpp @@ -131,6 +131,23 @@ LuaDefine(table_clear, "c") { return LS.result(); } +LuaDefine(table_getflagbits, "c") { + LuaArg tab; + LuaRet bits; + LuaStack LS(L, tab, bits); + unsigned char ubits = lua_getflagbits(L, tab.index()); + LS.set(bits, ubits); + return LS.result(); +} + +LuaDefine(table_setflagbits, "c") { + LuaArg tab, bits; + LuaStack LS(L, tab, bits); + unsigned char ubits = LS.ckinteger(bits); + lua_setflagbits(L, tab.index(), ubits); + return LS.result(); +} + ///////////////////////////////////////////////////////////// // // Deque operators.