diff options
author | Jude Melton-Houghton <jwmhjwmh@gmail.com> | 2022-10-04 08:31:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-04 08:31:36 -0400 |
commit | 7632af3c73fc4e4ae3ad4c98c90c39b47c3b8379 (patch) | |
tree | 08b974d6ecafb6c20de565f96e329748030c1519 /src/script/lua_api/l_base.h | |
parent | b21fb1837955e6385137184cac906245821b20e4 (diff) | |
download | minetest-7632af3c73fc4e4ae3ad4c98c90c39b47c3b8379.tar.xz |
Consolidate API object code (#12728)
Co-authored-by: sfan5 <sfan5@live.de>
Diffstat (limited to 'src/script/lua_api/l_base.h')
-rw-r--r-- | src/script/lua_api/l_base.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/script/lua_api/l_base.h b/src/script/lua_api/l_base.h index aa5905d26..329e2cc26 100644 --- a/src/script/lua_api/l_base.h +++ b/src/script/lua_api/l_base.h @@ -74,6 +74,16 @@ public: lua_CFunction func, int top); + static void registerClass(lua_State *L, const char *name, + const luaL_Reg *methods, + const luaL_Reg *metamethods); + + template<typename T> + static inline T *checkObject(lua_State *L, int narg) + { + return *reinterpret_cast<T**>(luaL_checkudata(L, narg, T::className)); + } + /** * A wrapper for deprecated functions. * |