From d967a755e57da437c567c459cd2061d0cbf718ab Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Mon, 14 Nov 2016 21:06:53 +0100 Subject: [PATCH] Make love::Type handle type names TODO: Fix undefined behaviour in luax_register_type, you can't use a va_list after a reference type --HG-- branch : dynamiccore2 --- src/common/Module.cpp | 2 +- src/common/Object.cpp | 2 +- src/common/runtime.cpp | 48 ++++++-------- src/common/runtime.h | 16 ++--- src/common/types.cpp | 65 ++++++++++--------- src/common/types.h | 18 +++-- src/common/wrap_Data.cpp | 2 +- src/modules/audio/Source.cpp | 2 +- src/modules/audio/wrap_Source.cpp | 2 +- src/modules/filesystem/DroppedFile.cpp | 2 +- src/modules/filesystem/File.cpp | 2 +- src/modules/filesystem/FileData.cpp | 2 +- src/modules/filesystem/wrap_DroppedFile.cpp | 2 +- src/modules/filesystem/wrap_File.cpp | 2 +- src/modules/filesystem/wrap_FileData.cpp | 2 +- src/modules/font/GlyphData.cpp | 2 +- src/modules/font/Rasterizer.cpp | 2 +- src/modules/font/wrap_GlyphData.cpp | 2 +- src/modules/font/wrap_Rasterizer.cpp | 2 +- src/modules/graphics/Graphics.cpp | 2 +- src/modules/graphics/ParticleSystem.cpp | 2 +- src/modules/graphics/Quad.cpp | 2 +- src/modules/graphics/Texture.cpp | 3 +- src/modules/graphics/opengl/Canvas.cpp | 2 +- src/modules/graphics/opengl/Font.cpp | 3 +- src/modules/graphics/opengl/Image.cpp | 2 +- src/modules/graphics/opengl/Mesh.cpp | 2 +- src/modules/graphics/opengl/Shader.cpp | 2 +- src/modules/graphics/opengl/SpriteBatch.cpp | 2 +- src/modules/graphics/opengl/Text.cpp | 2 +- src/modules/graphics/opengl/Video.cpp | 2 +- src/modules/graphics/opengl/wrap_Canvas.cpp | 2 +- src/modules/graphics/opengl/wrap_Font.cpp | 2 +- src/modules/graphics/opengl/wrap_Graphics.cpp | 2 +- src/modules/graphics/opengl/wrap_Image.cpp | 2 +- src/modules/graphics/opengl/wrap_Mesh.cpp | 2 +- .../graphics/opengl/wrap_ParticleSystem.cpp | 2 +- src/modules/graphics/opengl/wrap_Shader.cpp | 2 +- .../graphics/opengl/wrap_SpriteBatch.cpp | 2 +- src/modules/graphics/opengl/wrap_Text.cpp | 2 +- src/modules/graphics/opengl/wrap_Video.cpp | 2 +- src/modules/graphics/wrap_Quad.cpp | 2 +- src/modules/graphics/wrap_Texture.cpp | 2 +- src/modules/image/CompressedImageData.cpp | 2 +- src/modules/image/ImageData.cpp | 2 +- .../image/wrap_CompressedImageData.cpp | 2 +- src/modules/image/wrap_ImageData.cpp | 2 +- src/modules/joystick/Joystick.cpp | 2 +- src/modules/joystick/wrap_Joystick.cpp | 2 +- src/modules/math/BezierCurve.cpp | 2 +- src/modules/math/CompressedData.cpp | 2 +- src/modules/math/RandomGenerator.cpp | 4 +- src/modules/math/wrap_BezierCurve.cpp | 2 +- src/modules/math/wrap_CompressedData.cpp | 2 +- src/modules/math/wrap_RandomGenerator.cpp | 2 +- src/modules/mouse/Cursor.cpp | 2 +- src/modules/mouse/wrap_Cursor.cpp | 2 +- src/modules/physics/Body.cpp | 2 +- src/modules/physics/Joint.cpp | 2 +- src/modules/physics/Shape.cpp | 2 +- src/modules/physics/box2d/ChainShape.cpp | 2 +- src/modules/physics/box2d/CircleShape.cpp | 2 +- src/modules/physics/box2d/Contact.cpp | 2 +- src/modules/physics/box2d/EdgeShape.cpp | 2 +- src/modules/physics/box2d/Fixture.cpp | 2 +- src/modules/physics/box2d/FrictionJoint.cpp | 2 +- src/modules/physics/box2d/GearJoint.cpp | 2 +- src/modules/physics/box2d/MotorJoint.cpp | 2 +- src/modules/physics/box2d/MouseJoint.cpp | 2 +- src/modules/physics/box2d/PolygonShape.cpp | 2 +- src/modules/physics/box2d/PrismaticJoint.cpp | 2 +- src/modules/physics/box2d/PulleyJoint.cpp | 2 +- src/modules/physics/box2d/RevoluteJoint.cpp | 2 +- src/modules/physics/box2d/RopeJoint.cpp | 2 +- src/modules/physics/box2d/WeldJoint.cpp | 2 +- src/modules/physics/box2d/WheelJoint.cpp | 2 +- src/modules/physics/box2d/World.cpp | 2 +- src/modules/physics/box2d/wrap_Body.cpp | 2 +- src/modules/physics/box2d/wrap_ChainShape.cpp | 2 +- .../physics/box2d/wrap_CircleShape.cpp | 2 +- src/modules/physics/box2d/wrap_Contact.cpp | 2 +- .../physics/box2d/wrap_DistanceJoint.cpp | 2 +- src/modules/physics/box2d/wrap_EdgeShape.cpp | 2 +- src/modules/physics/box2d/wrap_Fixture.cpp | 2 +- .../physics/box2d/wrap_FrictionJoint.cpp | 2 +- src/modules/physics/box2d/wrap_GearJoint.cpp | 2 +- src/modules/physics/box2d/wrap_Joint.cpp | 2 +- src/modules/physics/box2d/wrap_MotorJoint.cpp | 2 +- src/modules/physics/box2d/wrap_MouseJoint.cpp | 2 +- .../physics/box2d/wrap_PolygonShape.cpp | 2 +- .../physics/box2d/wrap_PrismaticJoint.cpp | 2 +- .../physics/box2d/wrap_PulleyJoint.cpp | 2 +- .../physics/box2d/wrap_RevoluteJoint.cpp | 2 +- src/modules/physics/box2d/wrap_RopeJoint.cpp | 2 +- src/modules/physics/box2d/wrap_Shape.cpp | 2 +- src/modules/physics/box2d/wrap_WeldJoint.cpp | 2 +- src/modules/physics/box2d/wrap_WheelJoint.cpp | 2 +- src/modules/physics/box2d/wrap_World.cpp | 2 +- src/modules/sound/Decoder.cpp | 2 +- src/modules/sound/Sound.cpp | 2 +- src/modules/sound/SoundData.cpp | 2 +- src/modules/sound/wrap_Decoder.cpp | 2 +- src/modules/sound/wrap_SoundData.cpp | 2 +- src/modules/thread/Channel.cpp | 2 +- src/modules/thread/LuaThread.cpp | 2 +- src/modules/thread/threads.cpp | 2 +- src/modules/thread/wrap_Channel.cpp | 2 +- src/modules/thread/wrap_LuaThread.cpp | 2 +- src/modules/video/VideoStream.cpp | 2 +- src/modules/video/wrap_VideoStream.cpp | 2 +- 110 files changed, 177 insertions(+), 186 deletions(-) diff --git a/src/common/Module.cpp b/src/common/Module.cpp index 050da2621..147f61d0e 100644 --- a/src/common/Module.cpp +++ b/src/common/Module.cpp @@ -58,7 +58,7 @@ namespace namespace love { -love::Type Module::type(&Object::type); +love::Type Module::type("Module", &Object::type); Module *Module::instances[] = {}; Module::~Module() diff --git a/src/common/Object.cpp b/src/common/Object.cpp index aef13aff5..4ffc34f34 100644 --- a/src/common/Object.cpp +++ b/src/common/Object.cpp @@ -24,7 +24,7 @@ namespace love { -love::Type Object::type({}); +love::Type Object::type("Object", nullptr); Object::Object() : count(1) diff --git a/src/common/runtime.cpp b/src/common/runtime.cpp index 40290da14..5a2461b68 100644 --- a/src/common/runtime.cpp +++ b/src/common/runtime.cpp @@ -67,9 +67,11 @@ static int w__type(lua_State *L) static int w__typeOf(lua_State *L) { Proxy *p = (Proxy *)lua_touserdata(L, 1); - //Type t = luax_type(L, 2); - love::Type &t = Object::type; // FIXME - luax_pushboolean(L, p->type->isa(t)); + Type *t = luax_type(L, 2); + if (!t) + luax_pushboolean(L, false); + else + luax_pushboolean(L, p->type->isa(*t)); return 1; } @@ -249,7 +251,7 @@ int luax_require(lua_State *L, const char *name) int luax_register_module(lua_State *L, const WrappedModule &m) { - love::addTypeName(m.type->getId(), m.name); + m.type->init(); // Put a reference to the C++ module in Lua. luax_insistregistry(L, REGISTRY_MODULES); @@ -305,9 +307,9 @@ int luax_preload(lua_State *L, lua_CFunction f, const char *name) return 0; } -int luax_register_type(lua_State *L, love::Type &type, const char *name, ...) +int luax_register_type(lua_State *L, love::Type &type, ...) { - love::addTypeName(type.getId(), name); + type.init(); // Get the place for storing and re-using instantiated love types. luax_getregistry(L, REGISTRY_OBJECTS); @@ -334,7 +336,7 @@ int luax_register_type(lua_State *L, love::Type &type, const char *name, ...) else lua_pop(L, 1); - luaL_newmetatable(L, name); + luaL_newmetatable(L, type.getName()); // m.__index = m lua_pushvalue(L, -1); @@ -349,12 +351,12 @@ int luax_register_type(lua_State *L, love::Type &type, const char *name, ...) lua_setfield(L, -2, "__eq"); // Add tostring function. - lua_pushstring(L, name); + lua_pushstring(L, type.getName()); lua_pushcclosure(L, w__tostring, 1); lua_setfield(L, -2, "__tostring"); // Add type - lua_pushstring(L, name); + lua_pushstring(L, type.getName()); lua_pushcclosure(L, w__type, 1); lua_setfield(L, -2, "type"); @@ -367,7 +369,7 @@ int luax_register_type(lua_State *L, love::Type &type, const char *name, ...) lua_setfield(L, -2, "release"); va_list fs; - va_start(fs, name); + va_start(fs, type); for (const luaL_Reg *f = va_arg(fs, const luaL_Reg *); f; f = va_arg(fs, const luaL_Reg *)) luax_setfuncs(L, f); va_end(fs); @@ -378,11 +380,8 @@ int luax_register_type(lua_State *L, love::Type &type, const char *name, ...) void luax_gettypemetatable(lua_State *L, love::Type &type) { - const char *name = nullptr; - if (getTypeName(type.getId(), name)) - lua_getfield(L, LUA_REGISTRYINDEX, name); - else - lua_pushnil(L); + const char *name = type.getName(); + lua_getfield(L, LUA_REGISTRYINDEX, name); } int luax_table_insert(lua_State *L, int tindex, int vindex, int pos) @@ -447,9 +446,7 @@ void luax_rawnewtype(lua_State *L, love::Type &type, love::Object *object) u->object = object; u->type = &type; - const char *name = "Invalid"; - getTypeName(type.getId(), name); - + const char *name = type.getName(); luaL_newmetatable(L, name); lua_setmetatable(L, -2); } @@ -706,7 +703,7 @@ lua_State *luax_getpinnedthread(lua_State *L) extern "C" int luax_typerror(lua_State *L, int narg, const char *tname) { int argtype = lua_type(L, narg); - const char *argtname = 0; + const char *argtname = nullptr; // We want to use the love type name for userdata, if possible. if (argtype == LUA_TUSERDATA && luaL_getmetafield(L, narg, "type") != 0) @@ -718,13 +715,12 @@ extern "C" int luax_typerror(lua_State *L, int narg, const char *tname) // Non-love userdata might have a type metamethod which doesn't // describe its type properly, so we only use it for love types. - uint32_t t; - if (!love::getTypeName(argtname, t)) - argtname = 0; + if (!Type::byName(argtname)) + argtname = nullptr; } } - if (argtname == 0) + if (argtname == nullptr) argtname = lua_typename(L, argtype); const char *msg = lua_pushfstring(L, "%s expected, got %s", tname, argtname); @@ -753,11 +749,9 @@ void luax_register(lua_State *L, const char *name, const luaL_Reg *l) } } -uint32_t luax_type(lua_State *L, int idx) +Type *luax_type(lua_State *L, int idx) { - uint32_t t = 0; - getTypeName(luaL_checkstring(L, idx), t); - return t; + return Type::byName(luaL_checkstring(L, idx)); } } // love diff --git a/src/common/runtime.h b/src/common/runtime.h index d45e73524..3238e626d 100644 --- a/src/common/runtime.h +++ b/src/common/runtime.h @@ -253,7 +253,7 @@ int luax_preload(lua_State *L, lua_CFunction f, const char *name); * @param name The type's human-readable name * @param ... The list of lists of member functions for the type. (of type luaL_Reg*) **/ -int luax_register_type(lua_State *L, love::Type &type, const char *name, ...); +int luax_register_type(lua_State *L, love::Type &type, ...); /** * Pushes the metatable of the specified type onto the stack. @@ -453,8 +453,7 @@ T *luax_checktype(lua_State *L, int idx, love::Type &type) { if (lua_type(L, idx) != LUA_TUSERDATA) { - const char *name = "Invalid"; - getTypeName(type.getId(), name); + const char *name = type.getName(); luax_typerror(L, idx, name); } @@ -462,8 +461,7 @@ T *luax_checktype(lua_State *L, int idx, love::Type &type) if (u->type == nullptr || !u->type->isa(type)) { - const char *name = "Invalid"; - getTypeName(type.getId(), name); + const char *name = type.getName(); luax_typerror(L, idx, name); } @@ -482,8 +480,7 @@ T *luax_checktype(lua_State *L, int idx) template T *luax_getmodule(lua_State *L, love::Type &type) { - const char *name = "Invalid"; - getTypeName(type.getId(), name); + const char *name = type.getName(); luax_insistregistry(L, REGISTRY_MODULES); lua_getfield(L, -1, name); @@ -510,8 +507,7 @@ T *luax_getmodule(lua_State *L) template T *luax_optmodule(lua_State *L, love::Type &type) { - const char *name = "Invalid"; - getTypeName(type.getId(), name); + const char *name = type.getName(); luax_insistregistry(L, REGISTRY_MODULES); lua_getfield(L, -1, name); @@ -563,7 +559,7 @@ T *luax_totype(lua_State *L, int idx) return luax_totype(L, idx, T::type); } -uint32 luax_type(lua_State *L, int idx); +Type *luax_type(lua_State *L, int idx); /** * Converts any exceptions thrown by the passed lambda function into a Lua error. diff --git a/src/common/types.cpp b/src/common/types.cpp index 9923c1a21..cb71ca6e6 100644 --- a/src/common/types.cpp +++ b/src/common/types.cpp @@ -18,41 +18,33 @@ * 3. This notice may not be removed or altered from any source distribution. **/ +// STL +#include + #include "types.h" -#include "StringMap.h" namespace love { -static StringMap types(nullptr, 0); - -void addTypeName(uint32 type, const char *name) -{ - const char *n; - if (!types.find(type, n)) - types.add(name, type); -} - -bool getTypeName(const char *in, uint32 &out) -{ - return types.find(in, out); -} - -bool getTypeName(uint32 in, const char *&out) -{ - return types.find(in, out); -} +static std::unordered_map types; uint32 love::Type::nextId = 1; -Type::Type(Type *parent) - : inited(false) +Type::Type(const char *name, Type *parent) + : name(name) , parent(parent) + , inited(false) { } -void love::Type::init() +void Type::init() { + // Make sure we don't init twice, that would be bad + if (inited) + return; + + // Note: we add it here, not in the constructor, because some Types can get initialized before the map! + types[name] = this; id = nextId++; bits[id] = true; inited = true; @@ -64,27 +56,40 @@ void love::Type::init() bits |= parent->bits; } -uint32 love::Type::getId() +uint32 Type::getId() { if (!inited) init(); return id; } -bool love::Type::isa(const uint32 &other) +bool Type::isa(const uint32 &other) { if (!inited) init(); return bits[other]; } -bool love::Type::isa(love::Type &other) +bool Type::isa(love::Type &other) { if (!other.inited) other.init(); return isa(other.id); } +const char *Type::getName() const +{ + return name; +} + +Type *Type::byName(const char *name) +{ + auto pos = types.find(name); + if (pos == types.end()) + return nullptr; + return pos->second; +} + } // love // FIXME: Move this to the relevant files @@ -94,8 +99,8 @@ bool love::Type::isa(love::Type &other) #include "filesystem/Filesystem.h" #include "image/Image.h" -love::Type love::Data::type(&Object::type); -love::Type love::Stream::type(&Object::type); -love::Type love::graphics::Drawable::type(&Object::type); -love::Type love::filesystem::Filesystem::type(&Module::type); -love::Type love::image::Image::type(&Module::type); +love::Type love::Data::type("Data", &Object::type); +love::Type love::Stream::type("Stream", &Object::type); +love::Type love::graphics::Drawable::type("Drawable", &Object::type); +love::Type love::filesystem::Filesystem::type("filesystem", &Module::type); +love::Type love::image::Image::type("image", &Module::type); diff --git a/src/common/types.h b/src/common/types.h index 302fb90da..43d112d08 100644 --- a/src/common/types.h +++ b/src/common/types.h @@ -30,31 +30,29 @@ namespace love { -void addTypeName(uint32 type, const char *name); -bool getTypeName(const char *in, uint32 &out); -bool getTypeName(uint32 in, const char *&out); - class Type { public: static const uint32 MAX_TYPES = 128; - // TODO: Type-checking templated constructor - Type(Type *parent); + Type(const char *name, Type *parent); Type(const Type&) = delete; + void init(); uint32 getId(); bool isa(const uint32 &other); bool isa(Type &other); + const char *getName() const; + + static Type *byName(const char *name); private: static uint32 nextId; - void init(); - - bool inited; - Type *parent; + const char * const name; + Type * const parent; uint32 id; + bool inited; std::bitset bits; }; diff --git a/src/common/wrap_Data.cpp b/src/common/wrap_Data.cpp index fb4edd8aa..2aeaf0f4b 100644 --- a/src/common/wrap_Data.cpp +++ b/src/common/wrap_Data.cpp @@ -59,7 +59,7 @@ const luaL_Reg w_Data_functions[] = int w_Data_open(lua_State *L) { - luax_register_type(L, Data::type, "Data", w_Data_functions, nullptr); + luax_register_type(L, Data::type, w_Data_functions, nullptr); return 0; } diff --git a/src/modules/audio/Source.cpp b/src/modules/audio/Source.cpp index a68f034b7..7f5563b0e 100644 --- a/src/modules/audio/Source.cpp +++ b/src/modules/audio/Source.cpp @@ -25,7 +25,7 @@ namespace love namespace audio { -love::Type Source::type(&Object::type); +love::Type Source::type("Source", &Object::type); Source::Source(Type sourceType) : sourceType(sourceType) diff --git a/src/modules/audio/wrap_Source.cpp b/src/modules/audio/wrap_Source.cpp index f80317dd8..931116f90 100644 --- a/src/modules/audio/wrap_Source.cpp +++ b/src/modules/audio/wrap_Source.cpp @@ -450,7 +450,7 @@ static const luaL_Reg w_Source_functions[] = extern "C" int luaopen_source(lua_State *L) { - return luax_register_type(L, love::audio::Source::type, "Source", w_Source_functions, nullptr); + return luax_register_type(L, love::audio::Source::type, w_Source_functions, nullptr); } } // audio diff --git a/src/modules/filesystem/DroppedFile.cpp b/src/modules/filesystem/DroppedFile.cpp index ebdee5565..a1fd1f5bb 100644 --- a/src/modules/filesystem/DroppedFile.cpp +++ b/src/modules/filesystem/DroppedFile.cpp @@ -37,7 +37,7 @@ namespace love namespace filesystem { -love::Type DroppedFile::type(&File::type); +love::Type DroppedFile::type("DroppedFile", &File::type); DroppedFile::DroppedFile(const std::string &filename) : filename(filename) diff --git a/src/modules/filesystem/File.cpp b/src/modules/filesystem/File.cpp index 95670c401..fdc4f4367 100644 --- a/src/modules/filesystem/File.cpp +++ b/src/modules/filesystem/File.cpp @@ -25,7 +25,7 @@ namespace love namespace filesystem { -love::Type File::type(&Object::type); +love::Type File::type("File", &Object::type); File::~File() { diff --git a/src/modules/filesystem/FileData.cpp b/src/modules/filesystem/FileData.cpp index 6b8a7e089..1fb52813a 100644 --- a/src/modules/filesystem/FileData.cpp +++ b/src/modules/filesystem/FileData.cpp @@ -29,7 +29,7 @@ namespace love namespace filesystem { -love::Type FileData::type(&Data::type); +love::Type FileData::type("FileData", &Data::type); FileData::FileData(uint64 size, const std::string &filename) : data(nullptr) diff --git a/src/modules/filesystem/wrap_DroppedFile.cpp b/src/modules/filesystem/wrap_DroppedFile.cpp index c8d09b99a..ccc8df2c6 100644 --- a/src/modules/filesystem/wrap_DroppedFile.cpp +++ b/src/modules/filesystem/wrap_DroppedFile.cpp @@ -33,7 +33,7 @@ DroppedFile *luax_checkdroppedfile(lua_State *L, int idx) extern "C" int luaopen_droppedfile(lua_State *L) { - return luax_register_type(L, DroppedFile::type, "DroppedFile", w_File_functions, nullptr); + return luax_register_type(L, DroppedFile::type, w_File_functions, nullptr); } } // filesystem diff --git a/src/modules/filesystem/wrap_File.cpp b/src/modules/filesystem/wrap_File.cpp index 3c3da7cf6..7c8dea92b 100644 --- a/src/modules/filesystem/wrap_File.cpp +++ b/src/modules/filesystem/wrap_File.cpp @@ -435,7 +435,7 @@ const luaL_Reg w_File_functions[] = extern "C" int luaopen_file(lua_State *L) { - return luax_register_type(L, File::type, "File", w_File_functions, nullptr); + return luax_register_type(L, File::type, w_File_functions, nullptr); } } // filesystem diff --git a/src/modules/filesystem/wrap_FileData.cpp b/src/modules/filesystem/wrap_FileData.cpp index bd66d3b14..4e7f7a6b4 100644 --- a/src/modules/filesystem/wrap_FileData.cpp +++ b/src/modules/filesystem/wrap_FileData.cpp @@ -56,7 +56,7 @@ static const luaL_Reg w_FileData_functions[] = extern "C" int luaopen_filedata(lua_State *L) { - return luax_register_type(L, FileData::type, "FileData", w_Data_functions, w_FileData_functions, nullptr); + return luax_register_type(L, FileData::type, w_Data_functions, w_FileData_functions, nullptr); } } // filesystem diff --git a/src/modules/font/GlyphData.cpp b/src/modules/font/GlyphData.cpp index da099d026..191e3de68 100644 --- a/src/modules/font/GlyphData.cpp +++ b/src/modules/font/GlyphData.cpp @@ -33,7 +33,7 @@ namespace love namespace font { -love::Type GlyphData::type(&Data::type); +love::Type GlyphData::type("GlyphData", &Data::type); GlyphData::GlyphData(uint32 glyph, GlyphMetrics glyphMetrics, GlyphData::Format f) : glyph(glyph) diff --git a/src/modules/font/Rasterizer.cpp b/src/modules/font/Rasterizer.cpp index 196b9206b..3632a18da 100644 --- a/src/modules/font/Rasterizer.cpp +++ b/src/modules/font/Rasterizer.cpp @@ -29,7 +29,7 @@ namespace love namespace font { -love::Type Rasterizer::type(&Object::type); +love::Type Rasterizer::type("Rasterizer", &Object::type); Rasterizer::~Rasterizer() { diff --git a/src/modules/font/wrap_GlyphData.cpp b/src/modules/font/wrap_GlyphData.cpp index 1708cebeb..bbd850ebb 100644 --- a/src/modules/font/wrap_GlyphData.cpp +++ b/src/modules/font/wrap_GlyphData.cpp @@ -131,7 +131,7 @@ const luaL_Reg w_GlyphData_functions[] = extern "C" int luaopen_glyphdata(lua_State *L) { - return luax_register_type(L, GlyphData::type, "GlyphData", w_Data_functions, w_GlyphData_functions, nullptr); + return luax_register_type(L, GlyphData::type, w_Data_functions, w_GlyphData_functions, nullptr); } } // font diff --git a/src/modules/font/wrap_Rasterizer.cpp b/src/modules/font/wrap_Rasterizer.cpp index 040203102..55c3a5e21 100644 --- a/src/modules/font/wrap_Rasterizer.cpp +++ b/src/modules/font/wrap_Rasterizer.cpp @@ -139,7 +139,7 @@ const luaL_Reg w_Rasterizer_functions[] = extern "C" int luaopen_rasterizer(lua_State *L) { - return luax_register_type(L, Rasterizer::type, "Rasterizer", w_Rasterizer_functions, nullptr); + return luax_register_type(L, Rasterizer::type, w_Rasterizer_functions, nullptr); } } // font diff --git a/src/modules/graphics/Graphics.cpp b/src/modules/graphics/Graphics.cpp index 64ca2cc5d..253bc13b3 100644 --- a/src/modules/graphics/Graphics.cpp +++ b/src/modules/graphics/Graphics.cpp @@ -58,7 +58,7 @@ void unGammaCorrectColor(Colorf &c) } } -love::Type Graphics::type(&Module::type); +love::Type Graphics::type("graphics", &Module::type); Graphics::~Graphics() { diff --git a/src/modules/graphics/ParticleSystem.cpp b/src/modules/graphics/ParticleSystem.cpp index 2f496054c..018a9a39f 100644 --- a/src/modules/graphics/ParticleSystem.cpp +++ b/src/modules/graphics/ParticleSystem.cpp @@ -50,7 +50,7 @@ float calculate_variation(float inner, float outer, float var) } // anonymous namespace -love::Type ParticleSystem::type(&Drawable::type); +love::Type ParticleSystem::type("ParticleSystem", &Drawable::type); ParticleSystem::ParticleSystem(Texture *texture, uint32 size) : pMem(nullptr) diff --git a/src/modules/graphics/Quad.cpp b/src/modules/graphics/Quad.cpp index 833d81be0..f4bfb6a71 100644 --- a/src/modules/graphics/Quad.cpp +++ b/src/modules/graphics/Quad.cpp @@ -29,7 +29,7 @@ namespace love namespace graphics { -love::Type Quad::type(&Object::type); +love::Type Quad::type("Quad", &Object::type); Quad::Quad(const Quad::Viewport &v, double sw, double sh) : sw(sw) diff --git a/src/modules/graphics/Texture.cpp b/src/modules/graphics/Texture.cpp index 8bdaae19b..1ba8c3ca2 100644 --- a/src/modules/graphics/Texture.cpp +++ b/src/modules/graphics/Texture.cpp @@ -25,8 +25,7 @@ namespace love namespace graphics { -love::Type Texture::type(&Drawable::type); - +love::Type Texture::type("Texture", &Drawable::type); Texture::Filter Texture::defaultFilter; Texture::Texture() diff --git a/src/modules/graphics/opengl/Canvas.cpp b/src/modules/graphics/opengl/Canvas.cpp index efd12efd6..e2a986fba 100644 --- a/src/modules/graphics/opengl/Canvas.cpp +++ b/src/modules/graphics/opengl/Canvas.cpp @@ -88,7 +88,7 @@ static GLenum createMSAABuffer(int width, int height, int &samples, GLenum iform return status; } -love::Type Canvas::type(&Texture::type); +love::Type Canvas::type("Canvas", &Texture::type); Canvas *Canvas::current = nullptr; OpenGL::Viewport Canvas::systemViewport = OpenGL::Viewport(); bool Canvas::screenHasSRGB = false; diff --git a/src/modules/graphics/opengl/Font.cpp b/src/modules/graphics/opengl/Font.cpp index ebae44ab9..65e78563f 100644 --- a/src/modules/graphics/opengl/Font.cpp +++ b/src/modules/graphics/opengl/Font.cpp @@ -39,13 +39,12 @@ namespace graphics namespace opengl { -love::Type Font::type(&Object::type); - static inline uint16 normToUint16(double n) { return (uint16) (n * LOVE_UINT16_MAX); } +love::Type Font::type("Font", &Object::type); int Font::fontCount = 0; Font::Font(love::font::Rasterizer *r, const Texture::Filter &filter) diff --git a/src/modules/graphics/opengl/Image.cpp b/src/modules/graphics/opengl/Image.cpp index 06a8feb97..4005bba6e 100644 --- a/src/modules/graphics/opengl/Image.cpp +++ b/src/modules/graphics/opengl/Image.cpp @@ -43,7 +43,7 @@ namespace graphics namespace opengl { -love::Type Image::type(&Texture::type); +love::Type Image::type("Image", &Texture::type); int Image::imageCount = 0; diff --git a/src/modules/graphics/opengl/Mesh.cpp b/src/modules/graphics/opengl/Mesh.cpp index b95fb1858..13b25b87a 100644 --- a/src/modules/graphics/opengl/Mesh.cpp +++ b/src/modules/graphics/opengl/Mesh.cpp @@ -58,7 +58,7 @@ static std::vector getDefaultVertexFormat() return vertexformat; } -love::Type Mesh::type(&Drawable::type); +love::Type Mesh::type("Mesh", &Drawable::type); Mesh::Mesh(const std::vector &vertexformat, const void *data, size_t datasize, DrawMode drawmode, Usage usage) : vertexFormat(vertexformat) diff --git a/src/modules/graphics/opengl/Shader.cpp b/src/modules/graphics/opengl/Shader.cpp index 80bac9117..0f0440924 100644 --- a/src/modules/graphics/opengl/Shader.cpp +++ b/src/modules/graphics/opengl/Shader.cpp @@ -62,7 +62,7 @@ namespace } // anonymous namespace -love::Type Shader::type(&Object::type); +love::Type Shader::type("Shader", &Object::type); Shader *Shader::current = nullptr; Shader *Shader::defaultShader = nullptr; Shader *Shader::defaultVideoShader = nullptr; diff --git a/src/modules/graphics/opengl/SpriteBatch.cpp b/src/modules/graphics/opengl/SpriteBatch.cpp index 0a66d3b4d..abcc1e576 100644 --- a/src/modules/graphics/opengl/SpriteBatch.cpp +++ b/src/modules/graphics/opengl/SpriteBatch.cpp @@ -41,7 +41,7 @@ namespace graphics namespace opengl { -love::Type SpriteBatch::type(&Drawable::type); +love::Type SpriteBatch::type("SpriteBatch", &Drawable::type); SpriteBatch::SpriteBatch(Texture *texture, int size, Mesh::Usage usage) : texture(texture) diff --git a/src/modules/graphics/opengl/Text.cpp b/src/modules/graphics/opengl/Text.cpp index dbebc8bd9..828699014 100644 --- a/src/modules/graphics/opengl/Text.cpp +++ b/src/modules/graphics/opengl/Text.cpp @@ -30,7 +30,7 @@ namespace graphics namespace opengl { -love::Type Text::type(&Drawable::type); +love::Type Text::type("Text", &Drawable::type); Text::Text(Font *font, const std::vector &text) : font(font) diff --git a/src/modules/graphics/opengl/Video.cpp b/src/modules/graphics/opengl/Video.cpp index bea0b5ae0..8cddaac27 100644 --- a/src/modules/graphics/opengl/Video.cpp +++ b/src/modules/graphics/opengl/Video.cpp @@ -30,7 +30,7 @@ namespace graphics namespace opengl { -love::Type Video::type(&Drawable::type); +love::Type Video::type("Video", &Drawable::type); Video::Video(love::video::VideoStream *stream) : stream(stream) diff --git a/src/modules/graphics/opengl/wrap_Canvas.cpp b/src/modules/graphics/opengl/wrap_Canvas.cpp index df18bf0eb..dc819cbeb 100644 --- a/src/modules/graphics/opengl/wrap_Canvas.cpp +++ b/src/modules/graphics/opengl/wrap_Canvas.cpp @@ -112,7 +112,7 @@ static const luaL_Reg w_Canvas_functions[] = extern "C" int luaopen_canvas(lua_State *L) { - return luax_register_type(L, Canvas::type, "Canvas", w_Texture_functions, w_Canvas_functions, nullptr); + return luax_register_type(L, Canvas::type, w_Texture_functions, w_Canvas_functions, nullptr); } } // opengl diff --git a/src/modules/graphics/opengl/wrap_Font.cpp b/src/modules/graphics/opengl/wrap_Font.cpp index 2baecba11..ad6a7b5d2 100644 --- a/src/modules/graphics/opengl/wrap_Font.cpp +++ b/src/modules/graphics/opengl/wrap_Font.cpp @@ -207,7 +207,7 @@ static const luaL_Reg w_Font_functions[] = extern "C" int luaopen_font(lua_State *L) { - return luax_register_type(L, Font::type, "Font", w_Font_functions, nullptr); + return luax_register_type(L, Font::type, w_Font_functions, nullptr); } } // opengl diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index 45055618b..2c8919b1f 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -2090,7 +2090,7 @@ static const luaL_Reg functions[] = static int luaopen_drawable(lua_State *L) { - return luax_register_type(L, Drawable::type, "Drawable", nullptr); + return luax_register_type(L, Drawable::type, nullptr); } // Types for this module. diff --git a/src/modules/graphics/opengl/wrap_Image.cpp b/src/modules/graphics/opengl/wrap_Image.cpp index 11599e6f2..0041f9514 100644 --- a/src/modules/graphics/opengl/wrap_Image.cpp +++ b/src/modules/graphics/opengl/wrap_Image.cpp @@ -150,7 +150,7 @@ static const luaL_Reg w_Image_functions[] = extern "C" int luaopen_image(lua_State *L) { - return luax_register_type(L, Image::type, "Image", w_Texture_functions, w_Image_functions, nullptr); + return luax_register_type(L, Image::type, w_Texture_functions, w_Image_functions, nullptr); } } // opengl diff --git a/src/modules/graphics/opengl/wrap_Mesh.cpp b/src/modules/graphics/opengl/wrap_Mesh.cpp index 1230f2afb..43052456d 100644 --- a/src/modules/graphics/opengl/wrap_Mesh.cpp +++ b/src/modules/graphics/opengl/wrap_Mesh.cpp @@ -528,7 +528,7 @@ static const luaL_Reg w_Mesh_functions[] = extern "C" int luaopen_mesh(lua_State *L) { - return luax_register_type(L, Mesh::type, "Mesh", w_Mesh_functions, nullptr); + return luax_register_type(L, Mesh::type, w_Mesh_functions, nullptr); } } // opengl diff --git a/src/modules/graphics/opengl/wrap_ParticleSystem.cpp b/src/modules/graphics/opengl/wrap_ParticleSystem.cpp index 46d9d39e8..aa34d33ef 100644 --- a/src/modules/graphics/opengl/wrap_ParticleSystem.cpp +++ b/src/modules/graphics/opengl/wrap_ParticleSystem.cpp @@ -772,7 +772,7 @@ static const luaL_Reg w_ParticleSystem_functions[] = extern "C" int luaopen_particlesystem(lua_State *L) { - return luax_register_type(L, ParticleSystem::type, "ParticleSystem", w_ParticleSystem_functions, nullptr); + return luax_register_type(L, ParticleSystem::type, w_ParticleSystem_functions, nullptr); } } // opengl diff --git a/src/modules/graphics/opengl/wrap_Shader.cpp b/src/modules/graphics/opengl/wrap_Shader.cpp index 38a8a76d5..2557021d6 100644 --- a/src/modules/graphics/opengl/wrap_Shader.cpp +++ b/src/modules/graphics/opengl/wrap_Shader.cpp @@ -317,7 +317,7 @@ static const luaL_Reg w_Shader_functions[] = extern "C" int luaopen_shader(lua_State *L) { - return luax_register_type(L, Shader::type, "Shader", w_Shader_functions, nullptr); + return luax_register_type(L, Shader::type, w_Shader_functions, nullptr); } } // opengl diff --git a/src/modules/graphics/opengl/wrap_SpriteBatch.cpp b/src/modules/graphics/opengl/wrap_SpriteBatch.cpp index 4a2c3ad18..348d5c965 100644 --- a/src/modules/graphics/opengl/wrap_SpriteBatch.cpp +++ b/src/modules/graphics/opengl/wrap_SpriteBatch.cpp @@ -257,7 +257,7 @@ static const luaL_Reg w_SpriteBatch_functions[] = extern "C" int luaopen_spritebatch(lua_State *L) { - return luax_register_type(L, SpriteBatch::type, "SpriteBatch", w_SpriteBatch_functions, nullptr); + return luax_register_type(L, SpriteBatch::type, w_SpriteBatch_functions, nullptr); } } // opengl diff --git a/src/modules/graphics/opengl/wrap_Text.cpp b/src/modules/graphics/opengl/wrap_Text.cpp index 01067e792..d873a3642 100644 --- a/src/modules/graphics/opengl/wrap_Text.cpp +++ b/src/modules/graphics/opengl/wrap_Text.cpp @@ -245,7 +245,7 @@ static const luaL_Reg w_Text_functions[] = extern "C" int luaopen_text(lua_State *L) { - return luax_register_type(L, Text::type, "Text", w_Text_functions, nullptr); + return luax_register_type(L, Text::type, w_Text_functions, nullptr); } } // opengl diff --git a/src/modules/graphics/opengl/wrap_Video.cpp b/src/modules/graphics/opengl/wrap_Video.cpp index d48c9514b..dad6a1876 100644 --- a/src/modules/graphics/opengl/wrap_Video.cpp +++ b/src/modules/graphics/opengl/wrap_Video.cpp @@ -143,7 +143,7 @@ static const luaL_Reg functions[] = int luaopen_video(lua_State *L) { - int ret = luax_register_type(L, Video::type, "Video", functions, nullptr); + int ret = luax_register_type(L, Video::type, functions, nullptr); luaL_loadbuffer(L, video_lua, sizeof(video_lua), "Video.lua"); luax_gettypemetatable(L, Video::type); diff --git a/src/modules/graphics/wrap_Quad.cpp b/src/modules/graphics/wrap_Quad.cpp index 0105b7110..dfbe4cb1e 100644 --- a/src/modules/graphics/wrap_Quad.cpp +++ b/src/modules/graphics/wrap_Quad.cpp @@ -84,7 +84,7 @@ static const luaL_Reg w_Quad_functions[] = extern "C" int luaopen_quad(lua_State *L) { - return luax_register_type(L, Quad::type, "Quad", w_Quad_functions, nullptr); + return luax_register_type(L, Quad::type, w_Quad_functions, nullptr); } } // graphics diff --git a/src/modules/graphics/wrap_Texture.cpp b/src/modules/graphics/wrap_Texture.cpp index 5a98746a1..9929f0a87 100644 --- a/src/modules/graphics/wrap_Texture.cpp +++ b/src/modules/graphics/wrap_Texture.cpp @@ -139,7 +139,7 @@ const luaL_Reg w_Texture_functions[] = extern "C" int luaopen_texture(lua_State *L) { - return luax_register_type(L, Texture::type, "Texture", w_Texture_functions, nullptr); + return luax_register_type(L, Texture::type, w_Texture_functions, nullptr); } } // graphics diff --git a/src/modules/image/CompressedImageData.cpp b/src/modules/image/CompressedImageData.cpp index faa2fe8ad..9bf5dd817 100644 --- a/src/modules/image/CompressedImageData.cpp +++ b/src/modules/image/CompressedImageData.cpp @@ -25,7 +25,7 @@ namespace love namespace image { -love::Type CompressedImageData::type(&Data::type); +love::Type CompressedImageData::type("CompressedImageData", &Data::type); CompressedImageData::CompressedImageData() : format(FORMAT_UNKNOWN) diff --git a/src/modules/image/ImageData.cpp b/src/modules/image/ImageData.cpp index 3a9fc4c35..4ea88ef63 100644 --- a/src/modules/image/ImageData.cpp +++ b/src/modules/image/ImageData.cpp @@ -27,7 +27,7 @@ namespace love namespace image { -love::Type ImageData::type(&Data::type); +love::Type ImageData::type("ImageData", &Data::type); ImageData::ImageData() : data(nullptr) diff --git a/src/modules/image/wrap_CompressedImageData.cpp b/src/modules/image/wrap_CompressedImageData.cpp index f3bc01ebd..08fc9c85f 100644 --- a/src/modules/image/wrap_CompressedImageData.cpp +++ b/src/modules/image/wrap_CompressedImageData.cpp @@ -106,7 +106,7 @@ static const luaL_Reg w_CompressedImageData_functions[] = extern "C" int luaopen_compressedimagedata(lua_State *L) { - return luax_register_type(L, CompressedImageData::type, "CompressedImageData", w_Data_functions, w_CompressedImageData_functions, nullptr); + return luax_register_type(L, CompressedImageData::type, w_Data_functions, w_CompressedImageData_functions, nullptr); } } // image diff --git a/src/modules/image/wrap_ImageData.cpp b/src/modules/image/wrap_ImageData.cpp index 716bc7beb..ba22d9440 100644 --- a/src/modules/image/wrap_ImageData.cpp +++ b/src/modules/image/wrap_ImageData.cpp @@ -366,7 +366,7 @@ static const luaL_Reg w_ImageData_functions[] = extern "C" int luaopen_imagedata(lua_State *L) { - int ret = luax_register_type(L, ImageData::type, "ImageData", w_Data_functions, w_ImageData_functions, nullptr); + int ret = luax_register_type(L, ImageData::type, w_Data_functions, w_ImageData_functions, nullptr); luax_gettypemetatable(L, ImageData::type); diff --git a/src/modules/joystick/Joystick.cpp b/src/modules/joystick/Joystick.cpp index 7e03b6d25..33816506a 100644 --- a/src/modules/joystick/Joystick.cpp +++ b/src/modules/joystick/Joystick.cpp @@ -29,7 +29,7 @@ namespace love namespace joystick { -love::Type Joystick::type(&Object::type); +love::Type Joystick::type("Joystick", &Object::type); float Joystick::clampval(float x) { diff --git a/src/modules/joystick/wrap_Joystick.cpp b/src/modules/joystick/wrap_Joystick.cpp index 3c695ff20..5e4cebf45 100644 --- a/src/modules/joystick/wrap_Joystick.cpp +++ b/src/modules/joystick/wrap_Joystick.cpp @@ -296,7 +296,7 @@ static const luaL_Reg w_Joystick_functions[] = extern "C" int luaopen_joystick(lua_State *L) { - return luax_register_type(L, Joystick::type, "Joystick", w_Joystick_functions, nullptr); + return luax_register_type(L, Joystick::type, w_Joystick_functions, nullptr); } } // joystick diff --git a/src/modules/math/BezierCurve.cpp b/src/modules/math/BezierCurve.cpp index 0fc23b41f..cf8508547 100644 --- a/src/modules/math/BezierCurve.cpp +++ b/src/modules/math/BezierCurve.cpp @@ -83,7 +83,7 @@ namespace love namespace math { -love::Type BezierCurve::type(&Object::type); +love::Type BezierCurve::type("BezierCurve", &Object::type); BezierCurve::BezierCurve(const vector &pts) : controlPoints(pts) diff --git a/src/modules/math/CompressedData.cpp b/src/modules/math/CompressedData.cpp index 399141843..4929049b8 100644 --- a/src/modules/math/CompressedData.cpp +++ b/src/modules/math/CompressedData.cpp @@ -26,7 +26,7 @@ namespace love namespace math { -love::Type CompressedData::type(&Data::type); +love::Type CompressedData::type("CompressedData", &Data::type); CompressedData::CompressedData(Compressor::Format format, char *cdata, size_t compressedsize, size_t rawsize, bool own) : format(format) diff --git a/src/modules/math/RandomGenerator.cpp b/src/modules/math/RandomGenerator.cpp index c06b3bfa4..2d5d5b280 100644 --- a/src/modules/math/RandomGenerator.cpp +++ b/src/modules/math/RandomGenerator.cpp @@ -47,6 +47,8 @@ static uint64 wangHash64(uint64 key) return key; } +love::Type RandomGenerator::type("RandomGenerator", &Object::type); + // 64 bit Xorshift implementation taken from the end of Sec. 3 (page 4) in // George Marsaglia, "Xorshift RNGs", Journal of Statistical Software, Vol.8 (Issue 14), 2003 // Use an 'Xorshift*' variant, as shown here: http://xorshift.di.unimi.it @@ -62,8 +64,6 @@ RandomGenerator::RandomGenerator() setSeed(newseed); } -love::Type RandomGenerator::type(&Object::type); - uint64 RandomGenerator::rand() { rng_state.b64 ^= (rng_state.b64 >> 12); diff --git a/src/modules/math/wrap_BezierCurve.cpp b/src/modules/math/wrap_BezierCurve.cpp index 1ae91dbad..17c9da6e0 100644 --- a/src/modules/math/wrap_BezierCurve.cpp +++ b/src/modules/math/wrap_BezierCurve.cpp @@ -234,7 +234,7 @@ static const luaL_Reg w_BezierCurve_functions[] = extern "C" int luaopen_beziercurve(lua_State *L) { - return luax_register_type(L, BezierCurve::type, "BezierCurve", w_BezierCurve_functions, nullptr); + return luax_register_type(L, BezierCurve::type, w_BezierCurve_functions, nullptr); } } // math diff --git a/src/modules/math/wrap_CompressedData.cpp b/src/modules/math/wrap_CompressedData.cpp index 0faa0b6b0..0ef93469e 100644 --- a/src/modules/math/wrap_CompressedData.cpp +++ b/src/modules/math/wrap_CompressedData.cpp @@ -53,7 +53,7 @@ static const luaL_Reg w_CompressedData_functions[] = extern "C" int luaopen_compresseddata(lua_State *L) { - return luax_register_type(L, CompressedData::type, "CompressedData", w_Data_functions, w_CompressedData_functions, nullptr); + return luax_register_type(L, CompressedData::type, w_Data_functions, w_CompressedData_functions, nullptr); } } // math diff --git a/src/modules/math/wrap_RandomGenerator.cpp b/src/modules/math/wrap_RandomGenerator.cpp index 8795e00b9..239219368 100644 --- a/src/modules/math/wrap_RandomGenerator.cpp +++ b/src/modules/math/wrap_RandomGenerator.cpp @@ -147,7 +147,7 @@ static const luaL_Reg w_RandomGenerator_functions[] = extern "C" int luaopen_randomgenerator(lua_State *L) { - int n = luax_register_type(L, RandomGenerator::type, "RandomGenerator", w_RandomGenerator_functions, nullptr); + int n = luax_register_type(L, RandomGenerator::type, w_RandomGenerator_functions, nullptr); luax_gettypemetatable(L, RandomGenerator::type); diff --git a/src/modules/mouse/Cursor.cpp b/src/modules/mouse/Cursor.cpp index 79cc1b8aa..ff1e2d6b4 100644 --- a/src/modules/mouse/Cursor.cpp +++ b/src/modules/mouse/Cursor.cpp @@ -25,7 +25,7 @@ namespace love namespace mouse { -love::Type Cursor::type(&Object::type); +love::Type Cursor::type("Cursor", &Object::type); Cursor::~Cursor() { diff --git a/src/modules/mouse/wrap_Cursor.cpp b/src/modules/mouse/wrap_Cursor.cpp index 7f00e503e..d70a2619f 100644 --- a/src/modules/mouse/wrap_Cursor.cpp +++ b/src/modules/mouse/wrap_Cursor.cpp @@ -61,7 +61,7 @@ static const luaL_Reg w_Cursor_functions[] = extern "C" int luaopen_cursor(lua_State *L) { - return luax_register_type(L, Cursor::type, "Cursor", w_Cursor_functions, nullptr); + return luax_register_type(L, Cursor::type, w_Cursor_functions, nullptr); } } // mouse diff --git a/src/modules/physics/Body.cpp b/src/modules/physics/Body.cpp index 5cfa99286..6f5d9edcf 100644 --- a/src/modules/physics/Body.cpp +++ b/src/modules/physics/Body.cpp @@ -25,7 +25,7 @@ namespace love namespace physics { -love::Type Body::type(&Object::type); +love::Type Body::type("Body", &Object::type); Body::~Body() { diff --git a/src/modules/physics/Joint.cpp b/src/modules/physics/Joint.cpp index a5f131870..f3b2972c4 100644 --- a/src/modules/physics/Joint.cpp +++ b/src/modules/physics/Joint.cpp @@ -25,7 +25,7 @@ namespace love namespace physics { -love::Type Joint::type(&Object::type); +love::Type Joint::type("Joint", &Object::type); Joint::~Joint() { diff --git a/src/modules/physics/Shape.cpp b/src/modules/physics/Shape.cpp index 00e06f064..0ba5204f7 100644 --- a/src/modules/physics/Shape.cpp +++ b/src/modules/physics/Shape.cpp @@ -25,7 +25,7 @@ namespace love namespace physics { -love::Type Shape::type(&Object::type); +love::Type Shape::type("Shape", &Object::type); Shape::~Shape() { diff --git a/src/modules/physics/box2d/ChainShape.cpp b/src/modules/physics/box2d/ChainShape.cpp index 906e76294..c0bf21e39 100644 --- a/src/modules/physics/box2d/ChainShape.cpp +++ b/src/modules/physics/box2d/ChainShape.cpp @@ -34,7 +34,7 @@ namespace physics namespace box2d { -love::Type ChainShape::type(&Shape::type); +love::Type ChainShape::type("ChainShape", &Shape::type); ChainShape::ChainShape(b2ChainShape *c, bool loop, bool own) : Shape(c, own), loop(loop) diff --git a/src/modules/physics/box2d/CircleShape.cpp b/src/modules/physics/box2d/CircleShape.cpp index 36291271c..068db34a7 100644 --- a/src/modules/physics/box2d/CircleShape.cpp +++ b/src/modules/physics/box2d/CircleShape.cpp @@ -34,7 +34,7 @@ namespace physics namespace box2d { -love::Type CircleShape::type(&Shape::type); +love::Type CircleShape::type("CircleShape", &Shape::type); CircleShape::CircleShape(b2CircleShape *c, bool own) : Shape(c, own) diff --git a/src/modules/physics/box2d/Contact.cpp b/src/modules/physics/box2d/Contact.cpp index db18d18fb..f34fe51dd 100644 --- a/src/modules/physics/box2d/Contact.cpp +++ b/src/modules/physics/box2d/Contact.cpp @@ -31,7 +31,7 @@ namespace physics namespace box2d { -love::Type Contact::type(&Object::type); +love::Type Contact::type("Contact", &Object::type); Contact::Contact(b2Contact *contact) : contact(contact) diff --git a/src/modules/physics/box2d/EdgeShape.cpp b/src/modules/physics/box2d/EdgeShape.cpp index 40e0baf55..3a68d6c62 100644 --- a/src/modules/physics/box2d/EdgeShape.cpp +++ b/src/modules/physics/box2d/EdgeShape.cpp @@ -34,7 +34,7 @@ namespace physics namespace box2d { -love::Type EdgeShape::type(&Shape::type); +love::Type EdgeShape::type("EdgeShape", &Shape::type); EdgeShape::EdgeShape(b2EdgeShape *e, bool own) : Shape(e, own) diff --git a/src/modules/physics/box2d/Fixture.cpp b/src/modules/physics/box2d/Fixture.cpp index c7c3f0821..181675cc4 100644 --- a/src/modules/physics/box2d/Fixture.cpp +++ b/src/modules/physics/box2d/Fixture.cpp @@ -37,7 +37,7 @@ namespace physics namespace box2d { -love::Type Fixture::type(&Object::type); +love::Type Fixture::type("Fixture", &Object::type); Fixture::Fixture(Body *body, Shape *shape, float density) : body(body) diff --git a/src/modules/physics/box2d/FrictionJoint.cpp b/src/modules/physics/box2d/FrictionJoint.cpp index 4cec8aa02..af213e835 100644 --- a/src/modules/physics/box2d/FrictionJoint.cpp +++ b/src/modules/physics/box2d/FrictionJoint.cpp @@ -34,7 +34,7 @@ namespace physics namespace box2d { -love::Type FrictionJoint::type(&Joint::type); +love::Type FrictionJoint::type("FrictionJoint", &Joint::type); FrictionJoint::FrictionJoint(Body *body1, Body *body2, float xA, float yA, float xB, float yB, bool collideConnected) : Joint(body1, body2) diff --git a/src/modules/physics/box2d/GearJoint.cpp b/src/modules/physics/box2d/GearJoint.cpp index 1b1f8702c..e3440ff78 100644 --- a/src/modules/physics/box2d/GearJoint.cpp +++ b/src/modules/physics/box2d/GearJoint.cpp @@ -32,7 +32,7 @@ namespace physics namespace box2d { -love::Type GearJoint::type(&Joint::type); +love::Type GearJoint::type("GearJoint", &Joint::type); GearJoint::GearJoint(Joint *joint1, Joint *joint2, float ratio, bool collideConnected) : Joint(joint1->body2, joint2->body2) diff --git a/src/modules/physics/box2d/MotorJoint.cpp b/src/modules/physics/box2d/MotorJoint.cpp index 3eca55e57..e5e91e679 100644 --- a/src/modules/physics/box2d/MotorJoint.cpp +++ b/src/modules/physics/box2d/MotorJoint.cpp @@ -32,7 +32,7 @@ namespace physics namespace box2d { -love::Type MotorJoint::type(&Joint::type); +love::Type MotorJoint::type("MotorJoint", &Joint::type); MotorJoint::MotorJoint(Body *body1, Body *body2) : Joint(body1, body2) diff --git a/src/modules/physics/box2d/MouseJoint.cpp b/src/modules/physics/box2d/MouseJoint.cpp index 216609af5..db0f412e7 100644 --- a/src/modules/physics/box2d/MouseJoint.cpp +++ b/src/modules/physics/box2d/MouseJoint.cpp @@ -32,7 +32,7 @@ namespace physics namespace box2d { -love::Type MouseJoint::type(&Joint::type); +love::Type MouseJoint::type("MouseJoint", &Joint::type); MouseJoint::MouseJoint(Body *body1, float x, float y) : Joint(body1) diff --git a/src/modules/physics/box2d/PolygonShape.cpp b/src/modules/physics/box2d/PolygonShape.cpp index c5d715a64..3cbe7a034 100644 --- a/src/modules/physics/box2d/PolygonShape.cpp +++ b/src/modules/physics/box2d/PolygonShape.cpp @@ -34,7 +34,7 @@ namespace physics namespace box2d { -love::Type PolygonShape::type(&Shape::type); +love::Type PolygonShape::type("PolygonShape", &Shape::type); PolygonShape::PolygonShape(b2PolygonShape *p, bool own) : Shape(p, own) diff --git a/src/modules/physics/box2d/PrismaticJoint.cpp b/src/modules/physics/box2d/PrismaticJoint.cpp index 54c43c8e2..2cd483717 100644 --- a/src/modules/physics/box2d/PrismaticJoint.cpp +++ b/src/modules/physics/box2d/PrismaticJoint.cpp @@ -32,7 +32,7 @@ namespace physics namespace box2d { -love::Type PrismaticJoint::type(&Joint::type); +love::Type PrismaticJoint::type("PrismaticJoint", &Joint::type); PrismaticJoint::PrismaticJoint(Body *body1, Body *body2, float xA, float yA, float xB, float yB, float ax, float ay, bool collideConnected) : Joint(body1, body2) diff --git a/src/modules/physics/box2d/PulleyJoint.cpp b/src/modules/physics/box2d/PulleyJoint.cpp index 699a41331..b3cd2ab8f 100644 --- a/src/modules/physics/box2d/PulleyJoint.cpp +++ b/src/modules/physics/box2d/PulleyJoint.cpp @@ -32,7 +32,7 @@ namespace physics namespace box2d { -love::Type PulleyJoint::type(&Joint::type); +love::Type PulleyJoint::type("PulleyJoint", &Joint::type); PulleyJoint::PulleyJoint(Body *bodyA, Body *bodyB, b2Vec2 groundAnchorA, b2Vec2 groundAnchorB, b2Vec2 anchorA, b2Vec2 anchorB, float ratio, bool collideConnected) : Joint(bodyA, bodyB) diff --git a/src/modules/physics/box2d/RevoluteJoint.cpp b/src/modules/physics/box2d/RevoluteJoint.cpp index 8af609791..3f206d8fa 100644 --- a/src/modules/physics/box2d/RevoluteJoint.cpp +++ b/src/modules/physics/box2d/RevoluteJoint.cpp @@ -34,7 +34,7 @@ namespace physics namespace box2d { -love::Type RevoluteJoint::type(&Joint::type); +love::Type RevoluteJoint::type("RevoluteJoint", &Joint::type); RevoluteJoint::RevoluteJoint(Body *body1, Body *body2, float xA, float yA, float xB, float yB, bool collideConnected) : Joint(body1, body2) diff --git a/src/modules/physics/box2d/RopeJoint.cpp b/src/modules/physics/box2d/RopeJoint.cpp index 2e628cf17..7762b5db0 100644 --- a/src/modules/physics/box2d/RopeJoint.cpp +++ b/src/modules/physics/box2d/RopeJoint.cpp @@ -32,7 +32,7 @@ namespace physics namespace box2d { -love::Type RopeJoint::type(&Joint::type); +love::Type RopeJoint::type("RopeJoint", &Joint::type); RopeJoint::RopeJoint(Body *body1, Body *body2, float x1, float y1, float x2, float y2, float maxLength, bool collideConnected) : Joint(body1, body2) diff --git a/src/modules/physics/box2d/WeldJoint.cpp b/src/modules/physics/box2d/WeldJoint.cpp index f53ec7c8e..71e6091c0 100644 --- a/src/modules/physics/box2d/WeldJoint.cpp +++ b/src/modules/physics/box2d/WeldJoint.cpp @@ -34,7 +34,7 @@ namespace physics namespace box2d { -love::Type WeldJoint::type(&Joint::type); +love::Type WeldJoint::type("WeldJoint", &Joint::type); WeldJoint::WeldJoint(Body *body1, Body *body2, float xA, float yA, float xB, float yB, bool collideConnected) : Joint(body1, body2) diff --git a/src/modules/physics/box2d/WheelJoint.cpp b/src/modules/physics/box2d/WheelJoint.cpp index 2f1d9fcae..d5caab054 100644 --- a/src/modules/physics/box2d/WheelJoint.cpp +++ b/src/modules/physics/box2d/WheelJoint.cpp @@ -32,7 +32,7 @@ namespace physics namespace box2d { -love::Type WheelJoint::type(&Joint::type); +love::Type WheelJoint::type("WheelJoint", &Joint::type); WheelJoint::WheelJoint(Body *body1, Body *body2, float xA, float yA, float xB, float yB, float ax, float ay, bool collideConnected) : Joint(body1, body2) diff --git a/src/modules/physics/box2d/World.cpp b/src/modules/physics/box2d/World.cpp index 90ddeae35..973e84a57 100644 --- a/src/modules/physics/box2d/World.cpp +++ b/src/modules/physics/box2d/World.cpp @@ -34,7 +34,7 @@ namespace physics namespace box2d { -love::Type World::type(&Object::type); +love::Type World::type("World", &Object::type); World::ContactCallback::ContactCallback() : ref(nullptr) diff --git a/src/modules/physics/box2d/wrap_Body.cpp b/src/modules/physics/box2d/wrap_Body.cpp index 267c26ce7..5d23b37bb 100644 --- a/src/modules/physics/box2d/wrap_Body.cpp +++ b/src/modules/physics/box2d/wrap_Body.cpp @@ -650,7 +650,7 @@ static const luaL_Reg w_Body_functions[] = extern "C" int luaopen_body(lua_State *L) { - return luax_register_type(L, Body::type, "Body", w_Body_functions, nullptr); + return luax_register_type(L, Body::type, w_Body_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_ChainShape.cpp b/src/modules/physics/box2d/wrap_ChainShape.cpp index 390e43200..c736d05e9 100644 --- a/src/modules/physics/box2d/wrap_ChainShape.cpp +++ b/src/modules/physics/box2d/wrap_ChainShape.cpp @@ -149,7 +149,7 @@ static const luaL_Reg w_ChainShape_functions[] = extern "C" int luaopen_chainshape(lua_State *L) { - return luax_register_type(L, ChainShape::type, "ChainShape", w_Shape_functions, w_ChainShape_functions, nullptr); + return luax_register_type(L, ChainShape::type, w_Shape_functions, w_ChainShape_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_CircleShape.cpp b/src/modules/physics/box2d/wrap_CircleShape.cpp index e6cd7ff74..52a5a26f5 100644 --- a/src/modules/physics/box2d/wrap_CircleShape.cpp +++ b/src/modules/physics/box2d/wrap_CircleShape.cpp @@ -75,7 +75,7 @@ static const luaL_Reg w_CircleShape_functions[] = extern "C" int luaopen_circleshape(lua_State *L) { - return luax_register_type(L, CircleShape::type, "CircleShape", w_Shape_functions, w_CircleShape_functions, nullptr); + return luax_register_type(L, CircleShape::type, w_Shape_functions, w_CircleShape_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_Contact.cpp b/src/modules/physics/box2d/wrap_Contact.cpp index 8b48c9af2..7e8324393 100644 --- a/src/modules/physics/box2d/wrap_Contact.cpp +++ b/src/modules/physics/box2d/wrap_Contact.cpp @@ -181,7 +181,7 @@ static const luaL_Reg w_Contact_functions[] = extern "C" int luaopen_contact(lua_State *L) { - return luax_register_type(L, Contact::type, "Contact", w_Contact_functions, nullptr); + return luax_register_type(L, Contact::type, w_Contact_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_DistanceJoint.cpp b/src/modules/physics/box2d/wrap_DistanceJoint.cpp index 8fe06568f..9c311c578 100644 --- a/src/modules/physics/box2d/wrap_DistanceJoint.cpp +++ b/src/modules/physics/box2d/wrap_DistanceJoint.cpp @@ -93,7 +93,7 @@ static const luaL_Reg w_DistanceJoint_functions[] = extern "C" int luaopen_distancejoint(lua_State *L) { - return luax_register_type(L, DistanceJoint::type, "DistanceJoint", w_Joint_functions, w_DistanceJoint_functions, nullptr); + return luax_register_type(L, DistanceJoint::type, w_Joint_functions, w_DistanceJoint_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_EdgeShape.cpp b/src/modules/physics/box2d/wrap_EdgeShape.cpp index 9c2cb812a..81300ac33 100644 --- a/src/modules/physics/box2d/wrap_EdgeShape.cpp +++ b/src/modules/physics/box2d/wrap_EdgeShape.cpp @@ -105,7 +105,7 @@ static const luaL_Reg w_EdgeShape_functions[] = extern "C" int luaopen_edgeshape(lua_State *L) { - return luax_register_type(L, EdgeShape::type, "EdgeShape", w_Shape_functions, w_EdgeShape_functions, nullptr); + return luax_register_type(L, EdgeShape::type, w_Shape_functions, w_EdgeShape_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_Fixture.cpp b/src/modules/physics/box2d/wrap_Fixture.cpp index bdd6de676..55692429a 100644 --- a/src/modules/physics/box2d/wrap_Fixture.cpp +++ b/src/modules/physics/box2d/wrap_Fixture.cpp @@ -302,7 +302,7 @@ static const luaL_Reg w_Fixture_functions[] = extern "C" int luaopen_fixture(lua_State *L) { - return luax_register_type(L, Fixture::type, "Fixture", w_Fixture_functions, nullptr); + return luax_register_type(L, Fixture::type, w_Fixture_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_FrictionJoint.cpp b/src/modules/physics/box2d/wrap_FrictionJoint.cpp index 055b69191..d28d6448f 100644 --- a/src/modules/physics/box2d/wrap_FrictionJoint.cpp +++ b/src/modules/physics/box2d/wrap_FrictionJoint.cpp @@ -77,7 +77,7 @@ static const luaL_Reg w_FrictionJoint_functions[] = extern "C" int luaopen_frictionjoint(lua_State *L) { - return luax_register_type(L, FrictionJoint::type, "FrictionJoint", w_Joint_functions, w_FrictionJoint_functions, nullptr); + return luax_register_type(L, FrictionJoint::type, w_Joint_functions, w_FrictionJoint_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_GearJoint.cpp b/src/modules/physics/box2d/wrap_GearJoint.cpp index cd3ed1f26..d5e09e851 100644 --- a/src/modules/physics/box2d/wrap_GearJoint.cpp +++ b/src/modules/physics/box2d/wrap_GearJoint.cpp @@ -77,7 +77,7 @@ static const luaL_Reg w_GearJoint_functions[] = extern "C" int luaopen_gearjoint(lua_State *L) { - return luax_register_type(L, GearJoint::type, "GearJoint", w_Joint_functions, w_GearJoint_functions, nullptr); + return luax_register_type(L, GearJoint::type, w_Joint_functions, w_GearJoint_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_Joint.cpp b/src/modules/physics/box2d/wrap_Joint.cpp index 28b21afa3..d8972937b 100644 --- a/src/modules/physics/box2d/wrap_Joint.cpp +++ b/src/modules/physics/box2d/wrap_Joint.cpp @@ -182,7 +182,7 @@ const luaL_Reg w_Joint_functions[] = extern "C" int luaopen_joint(lua_State *L) { - return luax_register_type(L, Joint::type, "Joint", w_Joint_functions, nullptr); + return luax_register_type(L, Joint::type, w_Joint_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_MotorJoint.cpp b/src/modules/physics/box2d/wrap_MotorJoint.cpp index 4ae2a1f4c..8568440d8 100644 --- a/src/modules/physics/box2d/wrap_MotorJoint.cpp +++ b/src/modules/physics/box2d/wrap_MotorJoint.cpp @@ -127,7 +127,7 @@ static const luaL_Reg w_MotorJoint_functions[] = extern "C" int luaopen_motorjoint(lua_State *L) { - return luax_register_type(L, MotorJoint::type, "MotorJoint", w_Joint_functions, w_MotorJoint_functions, nullptr); + return luax_register_type(L, MotorJoint::type, w_Joint_functions, w_MotorJoint_functions, nullptr); } diff --git a/src/modules/physics/box2d/wrap_MouseJoint.cpp b/src/modules/physics/box2d/wrap_MouseJoint.cpp index afcbb0147..2bb76e282 100644 --- a/src/modules/physics/box2d/wrap_MouseJoint.cpp +++ b/src/modules/physics/box2d/wrap_MouseJoint.cpp @@ -111,7 +111,7 @@ static const luaL_Reg w_MouseJoint_functions[] = extern "C" int luaopen_mousejoint(lua_State *L) { - return luax_register_type(L, MouseJoint::type, "MouseJoint", w_Joint_functions, w_MouseJoint_functions, nullptr); + return luax_register_type(L, MouseJoint::type, w_Joint_functions, w_MouseJoint_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_PolygonShape.cpp b/src/modules/physics/box2d/wrap_PolygonShape.cpp index 10c5060f6..a8852bbcf 100644 --- a/src/modules/physics/box2d/wrap_PolygonShape.cpp +++ b/src/modules/physics/box2d/wrap_PolygonShape.cpp @@ -55,7 +55,7 @@ static const luaL_Reg w_PolygonShape_functions[] = extern "C" int luaopen_polygonshape(lua_State *L) { - return luax_register_type(L, PolygonShape::type, "PolygonShape", w_Shape_functions, w_PolygonShape_functions, nullptr); + return luax_register_type(L, PolygonShape::type, w_Shape_functions, w_PolygonShape_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_PrismaticJoint.cpp b/src/modules/physics/box2d/wrap_PrismaticJoint.cpp index 87a0c0990..fc0d51526 100644 --- a/src/modules/physics/box2d/wrap_PrismaticJoint.cpp +++ b/src/modules/physics/box2d/wrap_PrismaticJoint.cpp @@ -204,7 +204,7 @@ static const luaL_Reg w_PrismaticJoint_functions[] = extern "C" int luaopen_prismaticjoint(lua_State *L) { - return luax_register_type(L, PrismaticJoint::type, "PrismaticJoint", w_Joint_functions, w_PrismaticJoint_functions, nullptr); + return luax_register_type(L, PrismaticJoint::type, w_Joint_functions, w_PrismaticJoint_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_PulleyJoint.cpp b/src/modules/physics/box2d/wrap_PulleyJoint.cpp index 6c4094096..1f277d72a 100644 --- a/src/modules/physics/box2d/wrap_PulleyJoint.cpp +++ b/src/modules/physics/box2d/wrap_PulleyJoint.cpp @@ -74,7 +74,7 @@ static const luaL_Reg w_PulleyJoint_functions[] = extern "C" int luaopen_pulleyjoint(lua_State *L) { - return luax_register_type(L, PulleyJoint::type, "PulleyJoint", w_Joint_functions, w_PulleyJoint_functions, nullptr); + return luax_register_type(L, PulleyJoint::type, w_Joint_functions, w_PulleyJoint_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_RevoluteJoint.cpp b/src/modules/physics/box2d/wrap_RevoluteJoint.cpp index 43127007c..084bdf7f3 100644 --- a/src/modules/physics/box2d/wrap_RevoluteJoint.cpp +++ b/src/modules/physics/box2d/wrap_RevoluteJoint.cpp @@ -196,7 +196,7 @@ static const luaL_Reg w_RevoluteJoint_functions[] = extern "C" int luaopen_revolutejoint(lua_State *L) { - return luax_register_type(L, RevoluteJoint::type, "RevoluteJoint", w_Joint_functions, w_RevoluteJoint_functions, nullptr); + return luax_register_type(L, RevoluteJoint::type, w_Joint_functions, w_RevoluteJoint_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_RopeJoint.cpp b/src/modules/physics/box2d/wrap_RopeJoint.cpp index d744c88ca..95db646f4 100644 --- a/src/modules/physics/box2d/wrap_RopeJoint.cpp +++ b/src/modules/physics/box2d/wrap_RopeJoint.cpp @@ -50,7 +50,7 @@ static const luaL_Reg w_RopeJoint_functions[] = extern "C" int luaopen_ropejoint(lua_State *L) { - return luax_register_type(L, RopeJoint::type, "RopeJoint", w_Joint_functions, w_RopeJoint_functions, nullptr); + return luax_register_type(L, RopeJoint::type, w_Joint_functions, w_RopeJoint_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_Shape.cpp b/src/modules/physics/box2d/wrap_Shape.cpp index d9282f571..ec849fba2 100644 --- a/src/modules/physics/box2d/wrap_Shape.cpp +++ b/src/modules/physics/box2d/wrap_Shape.cpp @@ -108,7 +108,7 @@ const luaL_Reg w_Shape_functions[] = extern "C" int luaopen_shape(lua_State *L) { - return luax_register_type(L, Shape::type, "Shape", w_Shape_functions, nullptr); + return luax_register_type(L, Shape::type, w_Shape_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_WeldJoint.cpp b/src/modules/physics/box2d/wrap_WeldJoint.cpp index 27fea4459..d9a92eff0 100644 --- a/src/modules/physics/box2d/wrap_WeldJoint.cpp +++ b/src/modules/physics/box2d/wrap_WeldJoint.cpp @@ -84,7 +84,7 @@ static const luaL_Reg w_WeldJoint_functions[] = extern "C" int luaopen_weldjoint(lua_State *L) { - return luax_register_type(L, WeldJoint::type, "WeldJoint", w_Joint_functions, w_WeldJoint_functions, nullptr); + return luax_register_type(L, WeldJoint::type, w_Joint_functions, w_WeldJoint_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_WheelJoint.cpp b/src/modules/physics/box2d/wrap_WheelJoint.cpp index 9ff9a5633..723efc773 100644 --- a/src/modules/physics/box2d/wrap_WheelJoint.cpp +++ b/src/modules/physics/box2d/wrap_WheelJoint.cpp @@ -160,7 +160,7 @@ static const luaL_Reg w_WheelJoint_functions[] = extern "C" int luaopen_wheeljoint(lua_State *L) { - return luax_register_type(L, WheelJoint::type, "WheelJoint", w_Joint_functions, w_WheelJoint_functions, nullptr); + return luax_register_type(L, WheelJoint::type, w_Joint_functions, w_WheelJoint_functions, nullptr); } } // box2d diff --git a/src/modules/physics/box2d/wrap_World.cpp b/src/modules/physics/box2d/wrap_World.cpp index 3299d1456..a68552e24 100644 --- a/src/modules/physics/box2d/wrap_World.cpp +++ b/src/modules/physics/box2d/wrap_World.cpp @@ -237,7 +237,7 @@ static const luaL_Reg w_World_functions[] = extern "C" int luaopen_world(lua_State *L) { - return luax_register_type(L, World::type, "World", w_World_functions, nullptr); + return luax_register_type(L, World::type, w_World_functions, nullptr); } } // box2d diff --git a/src/modules/sound/Decoder.cpp b/src/modules/sound/Decoder.cpp index 9dc8678f2..6bca3deec 100644 --- a/src/modules/sound/Decoder.cpp +++ b/src/modules/sound/Decoder.cpp @@ -27,7 +27,7 @@ namespace love namespace sound { -love::Type Decoder::type(&Object::type); +love::Type Decoder::type("Decoder", &Object::type); Decoder::Decoder(Data *data, const std::string &ext, int bufferSize) : data(data) diff --git a/src/modules/sound/Sound.cpp b/src/modules/sound/Sound.cpp index 19f41cad3..86225407d 100644 --- a/src/modules/sound/Sound.cpp +++ b/src/modules/sound/Sound.cpp @@ -25,7 +25,7 @@ namespace love namespace sound { -love::Type Sound::type(&Module::type); +love::Type Sound::type("Sound", &Module::type); Sound::~Sound() { diff --git a/src/modules/sound/SoundData.cpp b/src/modules/sound/SoundData.cpp index 7be4a6ece..3c6296724 100644 --- a/src/modules/sound/SoundData.cpp +++ b/src/modules/sound/SoundData.cpp @@ -34,7 +34,7 @@ namespace love namespace sound { -love::Type SoundData::type(&Data::type); +love::Type SoundData::type("SoundData", &Data::type); SoundData::SoundData(Decoder *decoder) : data(0) diff --git a/src/modules/sound/wrap_Decoder.cpp b/src/modules/sound/wrap_Decoder.cpp index a93e5a50b..cf197995e 100644 --- a/src/modules/sound/wrap_Decoder.cpp +++ b/src/modules/sound/wrap_Decoder.cpp @@ -109,7 +109,7 @@ static const luaL_Reg w_Decoder_functions[] = extern "C" int luaopen_decoder(lua_State *L) { - return luax_register_type(L, Decoder::type, "Decoder", w_Decoder_functions, nullptr); + return luax_register_type(L, Decoder::type, w_Decoder_functions, nullptr); } } // sound diff --git a/src/modules/sound/wrap_SoundData.cpp b/src/modules/sound/wrap_SoundData.cpp index d134f563e..bb72ecce1 100644 --- a/src/modules/sound/wrap_SoundData.cpp +++ b/src/modules/sound/wrap_SoundData.cpp @@ -110,7 +110,7 @@ static const luaL_Reg w_SoundData_functions[] = extern "C" int luaopen_sounddata(lua_State *L) { - int ret = luax_register_type(L, SoundData::type, "SoundData", w_Data_functions, w_SoundData_functions, nullptr); + int ret = luax_register_type(L, SoundData::type, w_Data_functions, w_SoundData_functions, nullptr); luax_gettypemetatable(L, SoundData::type); diff --git a/src/modules/thread/Channel.cpp b/src/modules/thread/Channel.cpp index 08e375654..3a4c4511d 100644 --- a/src/modules/thread/Channel.cpp +++ b/src/modules/thread/Channel.cpp @@ -27,7 +27,7 @@ namespace love namespace thread { -love::Type Channel::type(&Object::type); +love::Type Channel::type("Channel", &Object::type); static std::map namedChannels; static Mutex *namedChannelMutex; diff --git a/src/modules/thread/LuaThread.cpp b/src/modules/thread/LuaThread.cpp index 8293e5f6c..1366555ff 100644 --- a/src/modules/thread/LuaThread.cpp +++ b/src/modules/thread/LuaThread.cpp @@ -31,7 +31,7 @@ namespace love namespace thread { -love::Type LuaThread::type(&Threadable::type); +love::Type LuaThread::type("Thread", &Threadable::type); LuaThread::LuaThread(const std::string &name, love::Data *code) : code(code) diff --git a/src/modules/thread/threads.cpp b/src/modules/thread/threads.cpp index ee4a11fc3..2fc2f0cdc 100644 --- a/src/modules/thread/threads.cpp +++ b/src/modules/thread/threads.cpp @@ -74,7 +74,7 @@ void EmptyLock::setLock(Mutex &m) mutex = &m; } -love::Type Threadable::type(&Object::type); +love::Type Threadable::type("Threadable", &Object::type); Threadable::Threadable() { diff --git a/src/modules/thread/wrap_Channel.cpp b/src/modules/thread/wrap_Channel.cpp index ed8efdbec..1016a2a4c 100644 --- a/src/modules/thread/wrap_Channel.cpp +++ b/src/modules/thread/wrap_Channel.cpp @@ -147,7 +147,7 @@ static const luaL_Reg w_Channel_functions[] = extern "C" int luaopen_channel(lua_State *L) { - return luax_register_type(L, Channel::type, "Channel", w_Channel_functions, nullptr); + return luax_register_type(L, Channel::type, w_Channel_functions, nullptr); } } // thread diff --git a/src/modules/thread/wrap_LuaThread.cpp b/src/modules/thread/wrap_LuaThread.cpp index f70867e7c..97d48ce42 100644 --- a/src/modules/thread/wrap_LuaThread.cpp +++ b/src/modules/thread/wrap_LuaThread.cpp @@ -87,7 +87,7 @@ static const luaL_Reg w_Thread_functions[] = extern "C" int luaopen_thread(lua_State *L) { - return luax_register_type(L, LuaThread::type, "Thread", w_Thread_functions, nullptr); + return luax_register_type(L, LuaThread::type, w_Thread_functions, nullptr); } } // thread diff --git a/src/modules/video/VideoStream.cpp b/src/modules/video/VideoStream.cpp index 7f8ac934f..eaa91e640 100644 --- a/src/modules/video/VideoStream.cpp +++ b/src/modules/video/VideoStream.cpp @@ -27,7 +27,7 @@ namespace love namespace video { -love::Type VideoStream::type(&Stream::type); +love::Type VideoStream::type("VideoStream", &Stream::type); void VideoStream::setSync(VideoStream::FrameSync *frameSync) { diff --git a/src/modules/video/wrap_VideoStream.cpp b/src/modules/video/wrap_VideoStream.cpp index 4fad7668c..84e9e82a1 100644 --- a/src/modules/video/wrap_VideoStream.cpp +++ b/src/modules/video/wrap_VideoStream.cpp @@ -124,7 +124,7 @@ static const luaL_Reg videostream_functions[] = int luaopen_videostream(lua_State *L) { - return luax_register_type(L, VideoStream::type, "VideoStream", videostream_functions, nullptr); + return luax_register_type(L, VideoStream::type, videostream_functions, nullptr); } } // video