add VoxelStructure lua usertype

This commit is contained in:
MihailRis
2024-09-19 18:41:34 +03:00
parent bf9f81a98c
commit 88b0f8e3d6
17 changed files with 180 additions and 60 deletions
+5 -3
View File
@@ -248,10 +248,12 @@ namespace lua {
return 1;
}
template <class T, lua_CFunction func>
inline void newusertype(lua::State* L, const std::string& name) {
template <class T>
inline std::enable_if_t<std::is_base_of_v<Userdata, T>>
newusertype(lua::State* L) {
const std::string& name = T::TYPENAME;
usertypeNames[typeid(T)] = name;
func(L);
T::createMetatable(L);
pushcfunction(L, userdata_destructor);
setfield(L, "__gc");