From 7632af3c73fc4e4ae3ad4c98c90c39b47c3b8379 Mon Sep 17 00:00:00 2001 From: Jude Melton-Houghton Date: Tue, 4 Oct 2022 08:31:36 -0400 Subject: Consolidate API object code (#12728) Co-authored-by: sfan5 --- src/script/lua_api/l_base.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/script/lua_api/l_base.h') 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 + static inline T *checkObject(lua_State *L, int narg) + { + return *reinterpret_cast(luaL_checkudata(L, narg, T::className)); + } + /** * A wrapper for deprecated functions. * -- cgit v1.2.3