From 1b5b88f2606c1e587b08228890208d9996cdbabf Mon Sep 17 00:00:00 2001 From: chai Date: Sun, 9 Sep 2018 18:16:07 +0800 Subject: *update --- src/lua/libraries/luax/luax.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/lua/libraries/luax/luax.h') diff --git a/src/lua/libraries/luax/luax.h b/src/lua/libraries/luax/luax.h index b6b3e80..1c83912 100644 --- a/src/lua/libraries/luax/luax.h +++ b/src/lua/libraries/luax/luax.h @@ -401,6 +401,20 @@ inline void luax_setfieldstrings(lua_State* L, const luax_Str* strs) } } +typedef struct luax_Num +{ + const char* name; + float number; +}; + +inline void luax_setfieldnumbers(lua_State* L, const luax_Num* strs) +{ + for (int i = 0; strs[i].name != 0; ++i) + { + luax_setfieldnumber(L, strs[i].name, strs[i].number); + } +} + typedef luaL_Reg luax_Ref; #endif // #if LUA_VERSION_NUM == 501 -- cgit v1.1-26-g67d0