From 9f6aa716fad623ac494fa52baf873897af65d9a9 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Mon, 14 Nov 2016 21:51:47 +0100 Subject: [PATCH] Pass Type to luax_register_type by pointer instead of reference Since the type is passed to va_start, and apparently that's undefined behaviour if it's a reference. the best kind of behavior --HG-- branch : dynamiccore2 --- src/common/runtime.cpp | 10 +++++----- src/common/runtime.h | 5 +++-- src/common/wrap_Data.cpp | 2 +- src/modules/audio/wrap_Source.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/wrap_GlyphData.cpp | 2 +- src/modules/font/wrap_Rasterizer.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 +- src/modules/graphics/opengl/wrap_ParticleSystem.cpp | 2 +- src/modules/graphics/opengl/wrap_Shader.cpp | 2 +- src/modules/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/wrap_CompressedImageData.cpp | 2 +- src/modules/image/wrap_ImageData.cpp | 2 +- src/modules/joystick/wrap_Joystick.cpp | 2 +- src/modules/math/wrap_BezierCurve.cpp | 2 +- src/modules/math/wrap_CompressedData.cpp | 2 +- src/modules/math/wrap_RandomGenerator.cpp | 2 +- src/modules/mouse/wrap_Cursor.cpp | 2 +- src/modules/physics/box2d/wrap_Body.cpp | 2 +- src/modules/physics/box2d/wrap_ChainShape.cpp | 2 +- src/modules/physics/box2d/wrap_CircleShape.cpp | 2 +- src/modules/physics/box2d/wrap_Contact.cpp | 2 +- src/modules/physics/box2d/wrap_DistanceJoint.cpp | 2 +- src/modules/physics/box2d/wrap_EdgeShape.cpp | 2 +- src/modules/physics/box2d/wrap_Fixture.cpp | 2 +- src/modules/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 +- src/modules/physics/box2d/wrap_PolygonShape.cpp | 2 +- src/modules/physics/box2d/wrap_PrismaticJoint.cpp | 2 +- src/modules/physics/box2d/wrap_PulleyJoint.cpp | 2 +- src/modules/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/wrap_Decoder.cpp | 2 +- src/modules/sound/wrap_SoundData.cpp | 2 +- src/modules/thread/wrap_Channel.cpp | 2 +- src/modules/thread/wrap_LuaThread.cpp | 2 +- src/modules/video/wrap_VideoStream.cpp | 2 +- 54 files changed, 60 insertions(+), 59 deletions(-) diff --git a/src/common/runtime.cpp b/src/common/runtime.cpp index 5a2461b68..49d10c9ef 100644 --- a/src/common/runtime.cpp +++ b/src/common/runtime.cpp @@ -307,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, ...) +int luax_register_type(lua_State *L, love::Type *type, ...) { - type.init(); + type->init(); // Get the place for storing and re-using instantiated love types. luax_getregistry(L, REGISTRY_OBJECTS); @@ -336,7 +336,7 @@ int luax_register_type(lua_State *L, love::Type &type, ...) else lua_pop(L, 1); - luaL_newmetatable(L, type.getName()); + luaL_newmetatable(L, type->getName()); // m.__index = m lua_pushvalue(L, -1); @@ -351,12 +351,12 @@ int luax_register_type(lua_State *L, love::Type &type, ...) lua_setfield(L, -2, "__eq"); // Add tostring function. - lua_pushstring(L, type.getName()); + lua_pushstring(L, type->getName()); lua_pushcclosure(L, w__tostring, 1); lua_setfield(L, -2, "__tostring"); // Add type - lua_pushstring(L, type.getName()); + lua_pushstring(L, type->getName()); lua_pushcclosure(L, w__type, 1); lua_setfield(L, -2, "type"); diff --git a/src/common/runtime.h b/src/common/runtime.h index 3238e626d..cbd8eafad 100644 --- a/src/common/runtime.h +++ b/src/common/runtime.h @@ -249,11 +249,12 @@ int luax_preload(lua_State *L, lua_CFunction f, const char *name); /** * Register a new type. + * NOTE: The type is passed by pointer instead of reference because calling va_start + * on a reference is undefined behaviour. * @param type The type. - * @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, ...); +int luax_register_type(lua_State *L, love::Type *type, ...); /** * Pushes the metatable of the specified type onto the stack. diff --git a/src/common/wrap_Data.cpp b/src/common/wrap_Data.cpp index 2aeaf0f4b..38ce57d4b 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, w_Data_functions, nullptr); + luax_register_type(L, &Data::type, w_Data_functions, nullptr); return 0; } diff --git a/src/modules/audio/wrap_Source.cpp b/src/modules/audio/wrap_Source.cpp index 931116f90..c34c57762 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, w_Source_functions, nullptr); + return luax_register_type(L, &love::audio::Source::type, w_Source_functions, nullptr); } } // audio diff --git a/src/modules/filesystem/wrap_DroppedFile.cpp b/src/modules/filesystem/wrap_DroppedFile.cpp index ccc8df2c6..0d1b72039 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, 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 7c8dea92b..11fd67090 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, 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 4e7f7a6b4..010f70c4a 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, 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/wrap_GlyphData.cpp b/src/modules/font/wrap_GlyphData.cpp index bbd850ebb..03f5c2a56 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, 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 55c3a5e21..db1aaf0c9 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, w_Rasterizer_functions, nullptr); + return luax_register_type(L, &Rasterizer::type, w_Rasterizer_functions, nullptr); } } // font diff --git a/src/modules/graphics/opengl/wrap_Canvas.cpp b/src/modules/graphics/opengl/wrap_Canvas.cpp index dc819cbeb..d744864cd 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, 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 ad6a7b5d2..ce2c65a38 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, 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 2c8919b1f..13b2d41d5 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, 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 0041f9514..5ac78ebf4 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, 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 43052456d..c24de5ecb 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, 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 aa34d33ef..a513f70ad 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, 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 2557021d6..bb2fc0486 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, 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 348d5c965..5d98ad9fd 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, 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 d873a3642..029732bd4 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, 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 dad6a1876..9c2e54935 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, 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 dfbe4cb1e..4af48b44b 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, 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 9929f0a87..b47ff8724 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, w_Texture_functions, nullptr); + return luax_register_type(L, &Texture::type, w_Texture_functions, nullptr); } } // graphics diff --git a/src/modules/image/wrap_CompressedImageData.cpp b/src/modules/image/wrap_CompressedImageData.cpp index 08fc9c85f..165b7864d 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, 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 ba22d9440..2e45d36da 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, 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/wrap_Joystick.cpp b/src/modules/joystick/wrap_Joystick.cpp index 5e4cebf45..8c4ed8491 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, w_Joystick_functions, nullptr); + return luax_register_type(L, &Joystick::type, w_Joystick_functions, nullptr); } } // joystick diff --git a/src/modules/math/wrap_BezierCurve.cpp b/src/modules/math/wrap_BezierCurve.cpp index 17c9da6e0..8c51aeb45 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, 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 0ef93469e..32f71c80d 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, 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 239219368..fa584d543 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, 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/wrap_Cursor.cpp b/src/modules/mouse/wrap_Cursor.cpp index d70a2619f..5212a40fa 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, w_Cursor_functions, nullptr); + return luax_register_type(L, &Cursor::type, w_Cursor_functions, nullptr); } } // mouse diff --git a/src/modules/physics/box2d/wrap_Body.cpp b/src/modules/physics/box2d/wrap_Body.cpp index 5d23b37bb..e918ee427 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, 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 c736d05e9..3011825d4 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, 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 52a5a26f5..134d0c64f 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, 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 7e8324393..1b350e743 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, 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 9c311c578..09e4c251f 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, 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 81300ac33..c3569bd17 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, 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 55692429a..131a55d71 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, 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 d28d6448f..c883c103a 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, 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 d5e09e851..7b624f3a6 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, 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 d8972937b..5cc5f75aa 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, 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 8568440d8..d9d5468a3 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, 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 2bb76e282..8750c1f12 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, 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 a8852bbcf..b162456f7 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, 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 fc0d51526..cfd7d3df5 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, 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 1f277d72a..b1d28035c 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, 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 084bdf7f3..62f0f93a4 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, 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 95db646f4..e01df8cd6 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, 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 ec849fba2..617e18fc7 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, 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 d9a92eff0..2d8ac2d5f 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, 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 723efc773..ed693ef65 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, 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 a68552e24..2ddf74bdf 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, w_World_functions, nullptr); + return luax_register_type(L, &World::type, w_World_functions, nullptr); } } // box2d diff --git a/src/modules/sound/wrap_Decoder.cpp b/src/modules/sound/wrap_Decoder.cpp index cf197995e..0b83202a8 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, 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 bb72ecce1..dc6582e43 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, 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/wrap_Channel.cpp b/src/modules/thread/wrap_Channel.cpp index 1016a2a4c..3701b8682 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, 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 97d48ce42..d7dd7c815 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, w_Thread_functions, nullptr); + return luax_register_type(L, &LuaThread::type, w_Thread_functions, nullptr); } } // thread diff --git a/src/modules/video/wrap_VideoStream.cpp b/src/modules/video/wrap_VideoStream.cpp index 84e9e82a1..f4f4b31e1 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_functions, nullptr); + return luax_register_type(L, &VideoStream::type, videostream_functions, nullptr); } } // video