Browse Source

Imported some of the dynamiccore branch from love-experiments:

- Type names for love's Lua objects are specified as an argument to luax_register_type, rather than being statically defined in an array.

- luax_register_type takes a variable number of method array arguments, for registering superclass methods without copying them into the subclass' method array.

Also removed most of the header declarations for wrapper functions.
Alex Szpakowski 9 years ago
parent
commit
2c4e713114
100 changed files with 203 additions and 1109 deletions
  1. 1 3
      src/common/Variant.cpp
  2. 23 15
      src/common/runtime.cpp
  3. 12 7
      src/common/runtime.h
  4. 10 91
      src/common/types.cpp
  5. 3 2
      src/common/types.h
  6. 1 1
      src/common/wrap_Data.cpp
  7. 1 3
      src/common/wrap_Data.h
  8. 0 23
      src/modules/audio/wrap_Audio.h
  9. 2 2
      src/modules/audio/wrap_Source.cpp
  10. 0 36
      src/modules/audio/wrap_Source.h
  11. 1 1
      src/modules/event/wrap_Event.cpp
  12. 0 7
      src/modules/event/wrap_Event.h
  13. 1 23
      src/modules/filesystem/wrap_DroppedFile.cpp
  14. 2 2
      src/modules/filesystem/wrap_File.cpp
  15. 2 16
      src/modules/filesystem/wrap_File.h
  16. 1 6
      src/modules/filesystem/wrap_FileData.cpp
  17. 0 2
      src/modules/filesystem/wrap_FileData.h
  18. 0 37
      src/modules/filesystem/wrap_Filesystem.h
  19. 2 7
      src/modules/font/wrap_GlyphData.cpp
  20. 0 9
      src/modules/font/wrap_GlyphData.h
  21. 2 2
      src/modules/font/wrap_Rasterizer.cpp
  22. 0 8
      src/modules/font/wrap_Rasterizer.h
  23. 2 11
      src/modules/graphics/opengl/wrap_Canvas.cpp
  24. 0 4
      src/modules/graphics/opengl/wrap_Canvas.h
  25. 2 2
      src/modules/graphics/opengl/wrap_Font.cpp
  26. 0 12
      src/modules/graphics/opengl/wrap_Font.h
  27. 7 0
      src/modules/graphics/opengl/wrap_Graphics.cpp
  28. 0 80
      src/modules/graphics/opengl/wrap_Graphics.h
  29. 2 11
      src/modules/graphics/opengl/wrap_Image.cpp
  30. 0 6
      src/modules/graphics/opengl/wrap_Image.h
  31. 2 2
      src/modules/graphics/opengl/wrap_Mesh.cpp
  32. 0 19
      src/modules/graphics/opengl/wrap_Mesh.h
  33. 2 2
      src/modules/graphics/opengl/wrap_ParticleSystem.cpp
  34. 0 60
      src/modules/graphics/opengl/wrap_ParticleSystem.h
  35. 2 2
      src/modules/graphics/opengl/wrap_Shader.cpp
  36. 0 8
      src/modules/graphics/opengl/wrap_Shader.h
  37. 2 2
      src/modules/graphics/opengl/wrap_SpriteBatch.cpp
  38. 0 13
      src/modules/graphics/opengl/wrap_SpriteBatch.h
  39. 2 2
      src/modules/graphics/opengl/wrap_Text.cpp
  40. 0 9
      src/modules/graphics/opengl/wrap_Text.h
  41. 2 2
      src/modules/graphics/wrap_Quad.cpp
  42. 0 2
      src/modules/graphics/wrap_Quad.h
  43. 17 0
      src/modules/graphics/wrap_Texture.cpp
  44. 3 7
      src/modules/graphics/wrap_Texture.h
  45. 12 8
      src/modules/image/magpie/Image.cpp
  46. 2 7
      src/modules/image/wrap_CompressedImageData.cpp
  47. 0 5
      src/modules/image/wrap_CompressedImageData.h
  48. 0 3
      src/modules/image/wrap_Image.h
  49. 10 15
      src/modules/image/wrap_ImageData.cpp
  50. 0 8
      src/modules/image/wrap_ImageData.h
  51. 2 2
      src/modules/joystick/wrap_Joystick.cpp
  52. 0 17
      src/modules/joystick/wrap_Joystick.h
  53. 0 5
      src/modules/joystick/wrap_JoystickModule.h
  54. 0 9
      src/modules/keyboard/wrap_Keyboard.h
  55. 4 0
      src/modules/love/love.cpp
  56. 2 2
      src/modules/math/wrap_BezierCurve.cpp
  57. 0 14
      src/modules/math/wrap_BezierCurve.h
  58. 2 7
      src/modules/math/wrap_CompressedData.cpp
  59. 0 1
      src/modules/math/wrap_CompressedData.h
  60. 0 15
      src/modules/math/wrap_Math.h
  61. 2 2
      src/modules/math/wrap_RandomGenerator.cpp
  62. 0 6
      src/modules/math/wrap_RandomGenerator.h
  63. 2 2
      src/modules/mouse/wrap_Cursor.cpp
  64. 0 1
      src/modules/mouse/wrap_Cursor.h
  65. 0 18
      src/modules/mouse/wrap_Mouse.h
  66. 2 2
      src/modules/physics/box2d/wrap_Body.cpp
  67. 0 58
      src/modules/physics/box2d/wrap_Body.h
  68. 2 10
      src/modules/physics/box2d/wrap_ChainShape.cpp
  69. 0 8
      src/modules/physics/box2d/wrap_ChainShape.h
  70. 2 10
      src/modules/physics/box2d/wrap_CircleShape.cpp
  71. 0 4
      src/modules/physics/box2d/wrap_CircleShape.h
  72. 22 22
      src/modules/physics/box2d/wrap_Contact.cpp
  73. 0 16
      src/modules/physics/box2d/wrap_Contact.h
  74. 2 13
      src/modules/physics/box2d/wrap_DistanceJoint.cpp
  75. 0 6
      src/modules/physics/box2d/wrap_DistanceJoint.h
  76. 2 10
      src/modules/physics/box2d/wrap_EdgeShape.cpp
  77. 0 1
      src/modules/physics/box2d/wrap_EdgeShape.h
  78. 2 2
      src/modules/physics/box2d/wrap_Fixture.cpp
  79. 0 27
      src/modules/physics/box2d/wrap_Fixture.h
  80. 2 13
      src/modules/physics/box2d/wrap_FrictionJoint.cpp
  81. 0 4
      src/modules/physics/box2d/wrap_FrictionJoint.h
  82. 2 13
      src/modules/physics/box2d/wrap_GearJoint.cpp
  83. 0 3
      src/modules/physics/box2d/wrap_GearJoint.h
  84. 2 2
      src/modules/physics/box2d/wrap_Joint.cpp
  85. 2 10
      src/modules/physics/box2d/wrap_Joint.h
  86. 2 13
      src/modules/physics/box2d/wrap_MotorJoint.cpp
  87. 0 10
      src/modules/physics/box2d/wrap_MotorJoint.h
  88. 2 13
      src/modules/physics/box2d/wrap_MouseJoint.cpp
  89. 0 8
      src/modules/physics/box2d/wrap_MouseJoint.h
  90. 0 22
      src/modules/physics/box2d/wrap_Physics.h
  91. 2 10
      src/modules/physics/box2d/wrap_PolygonShape.cpp
  92. 0 2
      src/modules/physics/box2d/wrap_PolygonShape.h
  93. 2 13
      src/modules/physics/box2d/wrap_PrismaticJoint.cpp
  94. 0 17
      src/modules/physics/box2d/wrap_PrismaticJoint.h
  95. 2 13
      src/modules/physics/box2d/wrap_PulleyJoint.cpp
  96. 0 4
      src/modules/physics/box2d/wrap_PulleyJoint.h
  97. 2 13
      src/modules/physics/box2d/wrap_RevoluteJoint.cpp
  98. 0 17
      src/modules/physics/box2d/wrap_RevoluteJoint.h
  99. 2 13
      src/modules/physics/box2d/wrap_RopeJoint.cpp
  100. 0 1
      src/modules/physics/box2d/wrap_RopeJoint.h

+ 1 - 3
src/common/Variant.cpp

@@ -24,8 +24,6 @@
 namespace love
 {
 
-extern StringMap<Type, TYPE_MAX_ENUM> types;
-
 static love::Type extractudatatype(lua_State *L, int idx)
 {
 	Type t = INVALID_ID;
@@ -36,7 +34,7 @@ static love::Type extractudatatype(lua_State *L, int idx)
 	lua_pushvalue(L, idx);
 	int result = lua_pcall(L, 1, 1, 0);
 	if (result == 0)
-		types.find(lua_tostring(L, -1), t);
+		getTypeName(lua_tostring(L, -1), t);
 	if (result == 0 || result == LUA_ERRRUN)
 		lua_pop(L, 1);
 	return t;

+ 23 - 15
src/common/runtime.cpp

@@ -216,6 +216,8 @@ int luax_require(lua_State *L, const char *name)
 
 int luax_register_module(lua_State *L, const WrappedModule &m)
 {
+	love::addTypeName(m.type, m.name);
+
 	// Put a reference to the C++ module in Lua.
 	luax_insistregistry(L, REGISTRY_MODULES);
 
@@ -270,12 +272,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 luaL_Reg *f, bool pushmetatable)
+int luax_register_type(lua_State *L, love::Type type, const char *name, ...)
 {
-	// Verify that this type name has a matching Type ID and type name mapping.
-	const char *tname = "Invalid";
-	if (!love::getType(type, tname))
-		printf("Missing type name entry for type ID %d\n", type);
+	love::addTypeName(type, name);
 
 	// Get the place for storing and re-using instantiated love types.
 	luax_getregistry(L, REGISTRY_OBJECTS);
@@ -302,7 +301,7 @@ int luax_register_type(lua_State *L, love::Type type, const luaL_Reg *f, bool pu
 	else
 		lua_pop(L, 1);
 
-	luaL_newmetatable(L, tname);
+	luaL_newmetatable(L, name);
 
 	// m.__index = m
 	lua_pushvalue(L, -1);
@@ -317,12 +316,12 @@ int luax_register_type(lua_State *L, love::Type type, const luaL_Reg *f, bool pu
 	lua_setfield(L, -2, "__eq");
 
 	// Add tostring function.
-	lua_pushstring(L, tname);
+	lua_pushstring(L, name);
 	lua_pushcclosure(L, w__tostring, 1);
 	lua_setfield(L, -2, "__tostring");
 
 	// Add type
-	lua_pushstring(L, tname);
+	lua_pushstring(L, name);
 	lua_pushcclosure(L, w__type, 1);
 	lua_setfield(L, -2, "type");
 
@@ -330,16 +329,25 @@ int luax_register_type(lua_State *L, love::Type type, const luaL_Reg *f, bool pu
 	lua_pushcfunction(L, w__typeOf);
 	lua_setfield(L, -2, "typeOf");
 
-	if (f != nullptr)
+	va_list fs;
+	va_start(fs, name);
+	for (const luaL_Reg *f = va_arg(fs, const luaL_Reg *); f; f = va_arg(fs, const luaL_Reg *))
 		luax_setfuncs(L, f);
-
-	if (pushmetatable)
-		return 1; // leave the metatable on the stack.
+	va_end(fs);
 
 	lua_pop(L, 1); // Pops metatable.
 	return 0;
 }
 
+void luax_gettypemetatable(lua_State *L, love::Type type)
+{
+	const char *name = nullptr;
+	if (getTypeName(type, name))
+		lua_getfield(L, LUA_REGISTRYINDEX, name);
+	else
+		lua_pushnil(L);
+}
+
 int luax_table_insert(lua_State *L, int tindex, int vindex, int pos)
 {
 	if (tindex < 0)
@@ -403,7 +411,7 @@ void luax_rawnewtype(lua_State *L, love::Type type, love::Object *object)
 	u->type = type;
 
 	const char *name = "Invalid";
-	getType(type, name);
+	getTypeName(type, name);
 
 	luaL_newmetatable(L, name);
 	lua_setmetatable(L, -2);
@@ -670,7 +678,7 @@ 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.
 			love::Type t;
-			if (!love::getType(argtname, t))
+			if (!love::getTypeName(argtname, t))
 				argtname = 0;
 		}
 	}
@@ -707,7 +715,7 @@ void luax_register(lua_State *L, const char *name, const luaL_Reg *l)
 Type luax_type(lua_State *L, int idx)
 {
 	Type t = INVALID_ID;
-	getType(luaL_checkstring(L, idx), t);
+	getTypeName(luaL_checkstring(L, idx), t);
 	return t;
 }
 

+ 12 - 7
src/common/runtime.h

@@ -247,10 +247,15 @@ int luax_preload(lua_State *L, lua_CFunction f, const char *name);
 /**
  * Register a new type.
  * @param type The type.
- * @param f The list of member functions for the type.
- * @param pushmetatable Whether to push the type's metatable to the stack.
+ * @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 luaL_Reg *f = nullptr, bool pushmetatable = false);
+int luax_register_type(lua_State *L, love::Type type, const char *name, ...);
+
+/**
+ * Pushes the metatable of the specified type onto the stack.
+**/
+void luax_gettypemetatable(lua_State *L, love::Type type);
 
 /**
  * Do a table.insert from C
@@ -434,7 +439,7 @@ T *luax_checktype(lua_State *L, int idx, love::Type type)
 	if (lua_type(L, idx) != LUA_TUSERDATA)
 	{
 		const char *name = "Invalid";
-		getType(type, name);
+		getTypeName(type, name);
 		luax_typerror(L, idx, name);
 	}
 
@@ -443,7 +448,7 @@ T *luax_checktype(lua_State *L, int idx, love::Type type)
 	if (!typeFlags[u->type][type])
 	{
 		const char *name = "Invalid";
-		getType(type, name);
+		getTypeName(type, name);
 		luax_typerror(L, idx, name);
 	}
 
@@ -454,7 +459,7 @@ template <typename T>
 T *luax_getmodule(lua_State *L, love::Type type)
 {
 	const char *name = "Invalid";
-	getType(type, name);
+	getTypeName(type, name);
 
 	luax_insistregistry(L, REGISTRY_MODULES);
 	lua_getfield(L, -1, name);
@@ -476,7 +481,7 @@ template <typename T>
 T *luax_optmodule(lua_State *L, love::Type type)
 {
 	const char *name = "Invalid";
-	getType(type, name);
+	getTypeName(type, name);
 
 	luax_insistregistry(L, REGISTRY_MODULES);
 	lua_getfield(L, -1, name);

+ 10 - 91
src/common/types.cpp

@@ -116,102 +116,21 @@ static const TypeBits *createTypeFlags()
 
 const TypeBits *typeFlags = createTypeFlags();
 
-StringMap<Type, TYPE_MAX_ENUM>::Entry typeEntries[] =
+static StringMap<Type, TYPE_MAX_ENUM> types(nullptr, 0);
+
+void addTypeName(Type type, const char *name)
 {
-	{"Invalid", INVALID_ID},
-
-	{"Object", OBJECT_ID},
-	{"Data", DATA_ID},
-	{"Module", MODULE_ID},
-
-	// Filesystem
-	{"File", FILESYSTEM_FILE_ID},
-	{"DroppedFile", FILESYSTEM_DROPPED_FILE_ID},
-	{"FileData", FILESYSTEM_FILE_DATA_ID},
-
-	// Font
-	{"GlyphData", FONT_GLYPH_DATA_ID},
-	{"Rasterizer", FONT_RASTERIZER_ID},
-
-	// Graphics
-	{"Drawable", GRAPHICS_DRAWABLE_ID},
-	{"Texture", GRAPHICS_TEXTURE_ID},
-	{"Image", GRAPHICS_IMAGE_ID},
-	{"Quad", GRAPHICS_QUAD_ID},
-	{"Font", GRAPHICS_FONT_ID},
-	{"ParticleSystem", GRAPHICS_PARTICLE_SYSTEM_ID},
-	{"SpriteBatch", GRAPHICS_SPRITE_BATCH_ID},
-	{"Canvas", GRAPHICS_CANVAS_ID},
-	{"Shader", GRAPHICS_SHADER_ID},
-	{"Mesh", GRAPHICS_MESH_ID},
-	{"Text", GRAPHICS_TEXT_ID},
-
-	// Image
-	{"ImageData", IMAGE_IMAGE_DATA_ID},
-	{"CompressedImageData", IMAGE_COMPRESSED_IMAGE_DATA_ID},
-
-	// Joystick
-	{"Joystick", JOYSTICK_JOYSTICK_ID},
-
-	// Math
-	{"RandomGenerator", MATH_RANDOM_GENERATOR_ID},
-	{"BezierCurve", MATH_BEZIER_CURVE_ID},
-	{"CompressedData", MATH_COMPRESSED_DATA_ID},
-
-	// Audio
-	{"Source", AUDIO_SOURCE_ID},
-
-	// Sound
-	{"SoundData", SOUND_SOUND_DATA_ID},
-	{"Decoder", SOUND_DECODER_ID},
-
-	// Mouse
-	{"Cursor", MOUSE_CURSOR_ID},
-
-	// Physics
-	{"World", PHYSICS_WORLD_ID},
-	{"Contact", PHYSICS_CONTACT_ID},
-	{"Body", PHYSICS_BODY_ID},
-	{"Fixture", PHYSICS_FIXTURE_ID},
-	{"Shape", PHYSICS_SHAPE_ID},
-	{"CircleShape", PHYSICS_CIRCLE_SHAPE_ID},
-	{"PolygonShape", PHYSICS_POLYGON_SHAPE_ID},
-	{"EdgeShape", PHYSICS_EDGE_SHAPE_ID},
-	{"ChainShape", PHYSICS_CHAIN_SHAPE_ID},
-	{"Joint", PHYSICS_JOINT_ID},
-	{"MouseJoint", PHYSICS_MOUSE_JOINT_ID},
-	{"DistanceJoint", PHYSICS_DISTANCE_JOINT_ID},
-	{"PrismaticJoint", PHYSICS_PRISMATIC_JOINT_ID},
-	{"RevoluteJoint", PHYSICS_REVOLUTE_JOINT_ID},
-	{"PulleyJoint", PHYSICS_PULLEY_JOINT_ID},
-	{"GearJoint", PHYSICS_GEAR_JOINT_ID},
-	{"FrictionJoint", PHYSICS_FRICTION_JOINT_ID},
-	{"WeldJoint", PHYSICS_WELD_JOINT_ID},
-	{"RopeJoint", PHYSICS_ROPE_JOINT_ID},
-	{"WheelJoint", PHYSICS_WHEEL_JOINT_ID},
-	{"MotorJoint", PHYSICS_MOTOR_JOINT_ID},
-
-	// Thread
-	{"Thread", THREAD_THREAD_ID},
-	{"Channel", THREAD_CHANNEL_ID},
-
-	// The modules themselves. Only add abstracted modules here.
-	{"filesystem", MODULE_FILESYSTEM_ID},
-	{"graphics", MODULE_GRAPHICS_ID},
-	{"image", MODULE_IMAGE_ID},
-	{"sound", MODULE_SOUND_ID},
-};
-
-StringMap<Type, TYPE_MAX_ENUM> types(typeEntries, sizeof(typeEntries));
-
-static_assert((sizeof(typeEntries) / sizeof(typeEntries[0])) == TYPE_MAX_ENUM, "Type name array size doesn't match the total number of type IDs!");
-
-bool getType(const char *in, love::Type &out)
+	const char *n;
+	if (!types.find(type, n))
+		types.add(name, type);
+}
+
+bool getTypeName(const char *in, love::Type &out)
 {
 	return types.find(in, out);
 }
 
-bool getType(love::Type in, const char *&out)
+bool getTypeName(love::Type in, const char *&out)
 {
 	return types.find(in, out);
 }

+ 3 - 2
src/common/types.h

@@ -123,8 +123,9 @@ typedef std::bitset<TYPE_MAX_ENUM> TypeBits;
  **/
 extern const TypeBits *typeFlags;
 
-bool getType(const char *in, Type &out);
-bool getType(Type in, const char *&out);
+void addTypeName(Type type, const char *name);
+bool getTypeName(const char *in, Type &out);
+bool getTypeName(Type in, const char *&out);
 
 } // love
 

+ 1 - 1
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_ID, w_Data_functions);
+	luax_register_type(L, DATA_ID, "Data", w_Data_functions, nullptr);
 	return 0;
 }
 

+ 1 - 3
src/common/wrap_Data.h

@@ -29,10 +29,8 @@ namespace love
 {
 
 Data *luax_checkdata(lua_State *L, int idx);
-int w_Data_getString(lua_State *L);
-int w_Data_getPointer(lua_State *L);
-int w_Data_getSize(lua_State *L);
 int w_Data_open(lua_State *L);
+extern const luaL_Reg w_Data_functions[];
 
 } // love
 

+ 0 - 23
src/modules/audio/wrap_Audio.h

@@ -32,29 +32,6 @@ namespace love
 namespace audio
 {
 
-int w_getSourceCount(lua_State *L);
-int w_newSource(lua_State *L);
-int w_play(lua_State *L);
-int w_stop(lua_State *L);
-int w_pause(lua_State *L);
-int w_resume(lua_State *L);
-int w_rewind(lua_State *L);
-int w_setVolume(lua_State *L);
-int w_getVolume(lua_State *L);
-int w_setPosition(lua_State *L);
-int w_getPosition(lua_State *L);
-int w_setOrientation(lua_State *L);
-int w_getOrientation(lua_State *L);
-int w_setVelocity(lua_State *L);
-int w_getVelocity(lua_State *L);
-int w_setDopplerScale(lua_State *L);
-int w_getDopplerScale(lua_State *L);
-int w_record(lua_State *L);
-int w_getRecordedData(lua_State *L);
-int w_stopRecording(lua_State *L);
-int w_canRecord(lua_State *L);
-int w_setDistanceModel(lua_State *L);
-int w_getDistanceModel(lua_State *L);
 extern "C" LOVE_EXPORT int luaopen_love_audio(lua_State *L);
 
 } // audio

+ 2 - 2
src/modules/audio/wrap_Source.cpp

@@ -370,7 +370,7 @@ int w_Source_getType(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_Source_functions[] =
 {
 	{ "clone", w_Source_clone },
 
@@ -420,7 +420,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_source(lua_State *L)
 {
-	return luax_register_type(L, AUDIO_SOURCE_ID, functions);
+	return luax_register_type(L, AUDIO_SOURCE_ID, "Source", w_Source_functions, nullptr);
 }
 
 } // audio

+ 0 - 36
src/modules/audio/wrap_Source.h

@@ -30,42 +30,6 @@ namespace audio
 {
 
 Source *luax_checksource(lua_State *L, int idx);
-int w_Source_clone(lua_State *L);
-int w_Source_play(lua_State *L);
-int w_Source_stop(lua_State *L);
-int w_Source_pause(lua_State *L);
-int w_Source_resume(lua_State *L);
-int w_Source_rewind(lua_State *L);
-int w_Source_setPitch(lua_State *L);
-int w_Source_getPitch(lua_State *L);
-int w_Source_setVolume(lua_State *L);
-int w_Source_getVolume(lua_State *L);
-int w_Source_seek(lua_State *L);
-int w_Source_tell(lua_State *L);
-int w_Source_getDuration(lua_State *L);
-int w_Source_setPosition(lua_State *L);
-int w_Source_getPosition(lua_State *L);
-int w_Source_setVelocity(lua_State *L);
-int w_Source_getVelocity(lua_State *L);
-int w_Source_setDirection(lua_State *L);
-int w_Source_getDirection(lua_State *L);
-int w_Source_setCone(lua_State *L);
-int w_Source_getCone(lua_State *L);
-int w_Source_setRelative(lua_State *L);
-int w_Source_isRelative(lua_State *L);
-int w_Source_setLooping(lua_State *L);
-int w_Source_isLooping(lua_State *L);
-int w_Source_isStopped(lua_State *L);
-int w_Source_isPaused(lua_State *L);
-int w_Source_isPlaying(lua_State *L);
-int w_Source_setVolumeLimits(lua_State *L);
-int w_Source_getVolumeLimits(lua_State *L);
-int w_Source_setAttenuationDistances(lua_State *L);
-int w_Source_getAttenuationDistances(lua_State *L);
-int w_Source_setRolloff(lua_State *L);
-int w_Source_getRolloff(lua_State *L);
-int w_Source_getChannels(lua_State *L);
-int w_Source_getType(lua_State *L);
 extern "C" int luaopen_source(lua_State *L);
 
 } // audio

+ 1 - 1
src/modules/event/wrap_Event.cpp

@@ -141,7 +141,7 @@ extern "C" int luaopen_love_event(lua_State *L)
 	w.name = "event";
 	w.type = MODULE_ID;
 	w.functions = functions;
-	w.types = 0;
+	w.types = nullptr;
 
 	return luax_register_module(L, w);
 }

+ 0 - 7
src/modules/event/wrap_Event.h

@@ -30,13 +30,6 @@ namespace love
 namespace event
 {
 
-int w_pump(lua_State *L);
-int w_poll(lua_State *L);
-int w_wait(lua_State *L);
-int w_push(lua_State *L);
-int w_clear(lua_State *L);
-int w_quit(lua_State *L);
-
 extern "C" LOVE_EXPORT int luaopen_love_event(lua_State *L);
 
 } // event

+ 1 - 23
src/modules/filesystem/wrap_DroppedFile.cpp

@@ -31,31 +31,9 @@ DroppedFile *luax_checkdroppedfile(lua_State *L, int idx)
 	return luax_checktype<DroppedFile>(L, idx, FILESYSTEM_DROPPED_FILE_ID);
 }
 
-static const luaL_Reg functions[] =
-{
-	// Inherits from File.
-	{ "getSize", w_File_getSize },
-	{ "open", w_File_open },
-	{ "close", w_File_close },
-	{ "isOpen", w_File_isOpen },
-	{ "read", w_File_read },
-	{ "write", w_File_write },
-	{ "flush", w_File_flush },
-	{ "isEOF", w_File_isEOF },
-	{ "tell", w_File_tell },
-	{ "seek", w_File_seek },
-	{ "lines", w_File_lines },
-	{ "setBuffer", w_File_setBuffer },
-	{ "getBuffer", w_File_getBuffer },
-	{ "getMode", w_File_getMode },
-	{ "getFilename", w_File_getFilename },
-	{ "getExtension", w_File_getExtension },
-	{ 0, 0 }
-};
-
 extern "C" int luaopen_droppedfile(lua_State *L)
 {
-	return luax_register_type(L, FILESYSTEM_DROPPED_FILE_ID, functions);
+	return luax_register_type(L, FILESYSTEM_DROPPED_FILE_ID, "DroppedFile", w_File_functions, nullptr);
 }
 
 } // filesystem

+ 2 - 2
src/modules/filesystem/wrap_File.cpp

@@ -413,7 +413,7 @@ int w_File_getExtension(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+const luaL_Reg w_File_functions[] =
 {
 	{ "getSize", w_File_getSize },
 	{ "open", w_File_open },
@@ -436,7 +436,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_file(lua_State *L)
 {
-	return luax_register_type(L, FILESYSTEM_FILE_ID, functions);
+	return luax_register_type(L, FILESYSTEM_FILE_ID, "File", w_File_functions, nullptr);
 }
 
 } // filesystem

+ 2 - 16
src/modules/filesystem/wrap_File.h

@@ -34,25 +34,11 @@ namespace filesystem
 int luax_ioError(lua_State *L, const char *fmt, ...);
 
 File *luax_checkfile(lua_State *L, int idx);
-int w_File_getSize(lua_State *L);
-int w_File_open(lua_State *L);
-int w_File_close(lua_State *L);
-int w_File_isOpen(lua_State *L);
-int w_File_read(lua_State *L);
-int w_File_write(lua_State *L);
-int w_File_flush(lua_State *L);
-int w_File_isEOF(lua_State *L);
-int w_File_tell(lua_State *L);
-int w_File_seek(lua_State *L);
 int w_File_lines_i(lua_State *L);
-int w_File_lines(lua_State *L);
-int w_File_setBuffer(lua_State *L);
-int w_File_getBuffer(lua_State *L);
-int w_File_getMode(lua_State *L);
-int w_File_getFilename(lua_State *L);
-int w_File_getExtension(lua_State *L);
 extern "C" int luaopen_file(lua_State *L);
 
+extern const luaL_Reg w_File_functions[];
+
 } // filesystem
 } // love
 

+ 1 - 6
src/modules/filesystem/wrap_FileData.cpp

@@ -48,11 +48,6 @@ int w_FileData_getExtension(lua_State *L)
 
 static const luaL_Reg w_FileData_functions[] =
 {
-	// Data
-	{ "getString", w_Data_getString },
-	{ "getPointer", w_Data_getPointer },
-	{ "getSize", w_Data_getSize },
-
 	{ "getFilename", w_FileData_getFilename },
 	{ "getExtension", w_FileData_getExtension },
 
@@ -61,7 +56,7 @@ static const luaL_Reg w_FileData_functions[] =
 
 extern "C" int luaopen_filedata(lua_State *L)
 {
-	return luax_register_type(L, FILESYSTEM_FILE_DATA_ID, w_FileData_functions);
+	return luax_register_type(L, FILESYSTEM_FILE_DATA_ID, "FileData", w_Data_functions, w_FileData_functions, nullptr);
 }
 
 } // filesystem

+ 0 - 2
src/modules/filesystem/wrap_FileData.h

@@ -31,8 +31,6 @@ namespace filesystem
 {
 
 FileData *luax_checkfiledata(lua_State *L, int idx);
-int w_FileData_getFilename(lua_State *L);
-int w_FileData_getExtension(lua_State *L);
 extern "C" int luaopen_filedata(lua_State *L);
 
 } // filesystem

+ 0 - 37
src/modules/filesystem/wrap_Filesystem.h

@@ -40,43 +40,6 @@ namespace filesystem
 FileData *luax_getfiledata(lua_State *L, int idx);
 
 bool hack_setupWriteDirectory();
-int w_init(lua_State *L);
-int w_setFused(lua_State *L);
-int w_isFused(lua_State *L);
-int w_setIdentity(lua_State *L);
-int w_getIdentity(lua_State *L);
-int w_setSource(lua_State *L);
-int w_getSource(lua_State *L);
-int w_mount(lua_State *L);
-int w_unmount(lua_State *L);
-int w_newFile(lua_State *L);
-int w_newFileData(lua_State *L);
-int w_getWorkingDirectory(lua_State *L);
-int w_getUserDirectory(lua_State *L);
-int w_getAppdataDirectory(lua_State *L);
-int w_getSaveDirectory(lua_State *L);
-int w_getSourceBaseDirectory(lua_State *L);
-int w_getRealDirectory(lua_State *L);
-int w_getExecutablePath(lua_State *L);
-int w_isDirectory(lua_State *L);
-int w_isFile(lua_State *L);
-int w_createDirectory(lua_State *L);
-int w_remove(lua_State *L);
-int w_open(lua_State *L);
-int w_close(lua_State *L);
-int w_read(lua_State *L);
-int w_write(lua_State *L);
-int w_append(lua_State *L);
-int w_getDirectoryItems(lua_State *L);
-int w_lines(lua_State *L);
-int w_load(lua_State *L);
-int w_getLastModified(lua_State *L);
-int w_getSize(lua_State *L);
-int w_setSymlinksEnabled(lua_State *L);
-int w_areSymlinksEnabled(lua_State *L);
-int w_isSymlink(lua_State *L);
-int w_getRequirePath(lua_State *L);
-int w_setRequirePath(lua_State *L);
 int loader(lua_State *L);
 int extloader(lua_State *L);
 extern "C" LOVE_EXPORT int luaopen_love_filesystem(lua_State *L);

+ 2 - 7
src/modules/font/wrap_GlyphData.cpp

@@ -115,13 +115,8 @@ int w_GlyphData_getFormat(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+const luaL_Reg w_GlyphData_functions[] =
 {
-	// Data
-	{ "getString", w_Data_getString },
-	{ "getPointer", w_Data_getPointer },
-	{ "getSize", w_Data_getSize },
-
 	{ "getWidth", w_GlyphData_getWidth },
 	{ "getHeight", w_GlyphData_getHeight },
 	{ "getDimensions", w_GlyphData_getDimensions },
@@ -136,7 +131,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_glyphdata(lua_State *L)
 {
-	return luax_register_type(L, FONT_GLYPH_DATA_ID, functions);
+	return luax_register_type(L, FONT_GLYPH_DATA_ID, "GlyphData", w_Data_functions, w_GlyphData_functions, nullptr);
 }
 
 } // font

+ 0 - 9
src/modules/font/wrap_GlyphData.h

@@ -33,15 +33,6 @@ namespace font
 {
 
 GlyphData *luax_checkglyphdata(lua_State *L, int idx);
-int w_GlyphData_getWidth(lua_State *L);
-int w_GlyphData_getHeight(lua_State *L);
-int w_GlyphData_getDimensions(lua_State *L);
-int w_GlyphData_getGlyph(lua_State *L);
-int w_GlyphData_getGlyphString(lua_State *L);
-int w_GlyphData_getAdvance(lua_State *L);
-int w_GlyphData_getBearing(lua_State *L);
-int w_GlyphData_getBoundingBox(lua_State *L);
-int w_GlyphData_getFormat(lua_State *L);
 extern "C" int luaopen_glyphdata(lua_State *L);
 
 } // font

+ 2 - 2
src/modules/font/wrap_Rasterizer.cpp

@@ -124,7 +124,7 @@ int w_Rasterizer_hasGlyphs(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+const luaL_Reg w_Rasterizer_functions[] =
 {
 	{ "getHeight", w_Rasterizer_getHeight },
 	{ "getAdvance", w_Rasterizer_getAdvance },
@@ -139,7 +139,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_rasterizer(lua_State *L)
 {
-	return luax_register_type(L, FONT_RASTERIZER_ID, functions);
+	return luax_register_type(L, FONT_RASTERIZER_ID, "Rasterizer", w_Rasterizer_functions, nullptr);
 }
 
 } // font

+ 0 - 8
src/modules/font/wrap_Rasterizer.h

@@ -31,14 +31,6 @@ namespace font
 {
 
 Rasterizer *luax_checkrasterizer(lua_State *L, int idx);
-int w_Rasterizer_getHeight(lua_State *L);
-int w_Rasterizer_getAdvance(lua_State *L);
-int w_Rasterizer_getAscent(lua_State *L);
-int w_Rasterizer_getDescent(lua_State *L);
-int w_Rasterizer_getLineHeight(lua_State *L);
-int w_Rasterizer_getGlyphData(lua_State *L);
-int w_Rasterizer_getGlyphCount(lua_State *L);
-int w_Rasterizer_hasGlyphs(lua_State *L);
 extern "C" int luaopen_rasterizer(lua_State *L);
 
 } // font

+ 2 - 11
src/modules/graphics/opengl/wrap_Canvas.cpp

@@ -101,17 +101,8 @@ int w_Canvas_getMSAA(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_Canvas_functions[] =
 {
-	// From wrap_Texture.
-	{ "getWidth", w_Texture_getWidth },
-	{ "getHeight", w_Texture_getHeight },
-	{ "getDimensions", w_Texture_getDimensions },
-	{ "setFilter", w_Texture_setFilter },
-	{ "getFilter", w_Texture_getFilter },
-	{ "setWrap", w_Texture_setWrap },
-	{ "getWrap", w_Texture_getWrap },
-
 	{ "renderTo", w_Canvas_renderTo },
 	{ "newImageData", w_Canvas_newImageData },
 	{ "getFormat", w_Canvas_getFormat },
@@ -121,7 +112,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_canvas(lua_State *L)
 {
-	return luax_register_type(L, GRAPHICS_CANVAS_ID, functions);
+	return luax_register_type(L, GRAPHICS_CANVAS_ID, "Canvas", w_Texture_functions, w_Canvas_functions, nullptr);
 }
 
 } // opengl

+ 0 - 4
src/modules/graphics/opengl/wrap_Canvas.h

@@ -35,10 +35,6 @@ namespace opengl
 
 //see Canvas.h
 Canvas *luax_checkcanvas(lua_State *L, int idx);
-int w_Canvas_renderTo(lua_State *L);
-int w_Canvas_newImageData(lua_State *L);
-int w_Canvas_getFormat(lua_State *L);
-int w_Canvas_getMSAA(lua_State *L);
 extern "C" int luaopen_canvas(lua_State *L);
 
 } // opengl

+ 2 - 2
src/modules/graphics/opengl/wrap_Font.cpp

@@ -184,7 +184,7 @@ int w_Font_setFallbacks(lua_State *L)
 	return 0;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_Font_functions[] =
 {
 	{ "getHeight", w_Font_getHeight },
 	{ "getWidth", w_Font_getWidth },
@@ -203,7 +203,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_font(lua_State *L)
 {
-	return luax_register_type(L, GRAPHICS_FONT_ID, functions);
+	return luax_register_type(L, GRAPHICS_FONT_ID, "Font", w_Font_functions, nullptr);
 }
 
 } // opengl

+ 0 - 12
src/modules/graphics/opengl/wrap_Font.h

@@ -33,18 +33,6 @@ namespace opengl
 {
 
 Font *luax_checkfont(lua_State *L, int idx);
-int w_Font_getHeight(lua_State *L);
-int w_Font_getWidth(lua_State *L);
-int w_Font_getWrap(lua_State *L);
-int w_Font_setLineHeight(lua_State *L);
-int w_Font_getLineHeight(lua_State *L);
-int w_Font_setFilter(lua_State *L);
-int w_Font_getFilter(lua_State *L);
-int w_Font_getAscent(lua_State *L);
-int w_Font_getDescent(lua_State *L);
-int w_Font_getBaseline(lua_State *L);
-int w_Font_hasGlyphs(lua_State *L);
-int w_Font_setFallbacks(lua_State *L);
 extern "C" int luaopen_font(lua_State *L);
 
 } // opengl

+ 7 - 0
src/modules/graphics/opengl/wrap_Graphics.cpp

@@ -1946,9 +1946,16 @@ static const luaL_Reg functions[] =
 	{ 0, 0 }
 };
 
+static int luaopen_drawable(lua_State *L)
+{
+	return luax_register_type(L, GRAPHICS_DRAWABLE_ID, "Drawable", nullptr);
+}
+
 // Types for this module.
 static const lua_CFunction types[] =
 {
+	luaopen_drawable,
+	luaopen_texture,
 	luaopen_font,
 	luaopen_image,
 	luaopen_quad,

+ 0 - 80
src/modules/graphics/opengl/wrap_Graphics.h

@@ -41,86 +41,6 @@ namespace graphics
 namespace opengl
 {
 
-int w_reset(lua_State *L);
-int w_clear(lua_State *L);
-int w_discard(lua_State *L);
-int w_present(lua_State *L);
-int w_isCreated(lua_State *L);
-int w_isActive(lua_State *L);
-int w_isGammaCorrect(lua_State *L);
-int w_getWidth(lua_State *L);
-int w_getHeight(lua_State *L);
-int w_getDimensions(lua_State *L);
-int w_setScissor(lua_State *L);
-int w_intersectScissor(lua_State *L);
-int w_getScissor(lua_State *L);
-int w_stencil(lua_State *L);
-int w_setStencilTest(lua_State *L);
-int w_getStencilTest(lua_State *L);
-int w_newImage(lua_State *L);
-int w_newQuad(lua_State *L);
-int w_newFont(lua_State *L);
-int w_newImageFont(lua_State *L);
-int w_newSpriteBatch(lua_State *L);
-int w_newParticleSystem(lua_State *L);
-int w_newCanvas(lua_State *L);
-int w_newShader(lua_State *L);
-int w_newMesh(lua_State *L);
-int w_newText(lua_State *L);
-int w_setColor(lua_State *L);
-int w_getColor(lua_State *L);
-int w_setBackgroundColor(lua_State *L);
-int w_getBackgroundColor(lua_State *L);
-int w_setNewFont(lua_State *L);
-int w_setFont(lua_State *L);
-int w_getFont(lua_State *L);
-int w_setColorMask(lua_State *L);
-int w_getColorMask(lua_State *L);
-int w_setBlendMode(lua_State *L);
-int w_getBlendMode(lua_State *L);
-int w_setDefaultFilter(lua_State *L);
-int w_getDefaultFilter(lua_State *L);
-int w_setDefaultMipmapFilter(lua_State *L);
-int w_getDefaultMipmapFilter(lua_State *L);
-int w_setLineWidth(lua_State *L);
-int w_setLineStyle(lua_State *L);
-int w_setLineJoin(lua_State *L);
-int w_getLineWidth(lua_State *L);
-int w_getLineStyle(lua_State *L);
-int w_getLineJoin(lua_State *L);
-int w_setPointSize(lua_State *L);
-int w_getPointSize(lua_State *L);
-int w_setWireframe(lua_State *L);
-int w_isWireframe(lua_State *L);
-int w_newScreenshot(lua_State *L);
-int w_setCanvas(lua_State *L);
-int w_getCanvas(lua_State *L);
-int w_setShader(lua_State *L);
-int w_getShader(lua_State *L);
-int w_setDefaultShaderCode(lua_State *L);
-int w_getSupported(lua_State *L);
-int w_getCanvasFormats(lua_State *L);
-int w_getCompressedImageFormats(lua_State *L);
-int w_getRendererInfo(lua_State *L);
-int w_getSystemLimits(lua_State *L);
-int w_getStats(lua_State *L);
-int w_draw(lua_State *L);
-int w_print(lua_State *L);
-int w_printf(lua_State *L);
-int w_points(lua_State *L);
-int w_line(lua_State *L);
-int w_rectangle(lua_State *L);
-int w_circle(lua_State *L);
-int w_ellipse(lua_State *L);
-int w_arc(lua_State *L);
-int w_polygon(lua_State *L);
-int w_push(lua_State *L);
-int w_pop(lua_State *L);
-int w_rotate(lua_State *L);
-int w_scale(lua_State *L);
-int w_translate(lua_State *L);
-int w_shear(lua_State *L);
-int w_origin(lua_State *L);
 extern "C" LOVE_EXPORT int luaopen_love_graphics(lua_State *L);
 
 } // opengl

+ 2 - 11
src/modules/graphics/opengl/wrap_Image.cpp

@@ -137,17 +137,8 @@ int w_Image_getFlags(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_Image_functions[] =
 {
-	// From wrap_Texture.
-	{ "getWidth", w_Texture_getWidth },
-	{ "getHeight", w_Texture_getHeight },
-	{ "getDimensions", w_Texture_getDimensions },
-	{ "setFilter", w_Texture_setFilter },
-	{ "getFilter", w_Texture_getFilter },
-	{ "setWrap", w_Texture_setWrap },
-	{ "getWrap", w_Texture_getWrap },
-
 	{ "setMipmapFilter", w_Image_setMipmapFilter },
 	{ "getMipmapFilter", w_Image_getMipmapFilter },
 	{ "isCompressed", w_Image_isCompressed },
@@ -159,7 +150,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_image(lua_State *L)
 {
-	return luax_register_type(L, GRAPHICS_IMAGE_ID, functions);
+	return luax_register_type(L, GRAPHICS_IMAGE_ID, "Image", w_Texture_functions, w_Image_functions, nullptr);
 }
 
 } // opengl

+ 0 - 6
src/modules/graphics/opengl/wrap_Image.h

@@ -34,12 +34,6 @@ namespace opengl
 {
 
 Image *luax_checkimage(lua_State *L, int idx);
-int w_Image_setMipmapFilter(lua_State *L);
-int w_Image_getMipmapFilter(lua_State *L);
-int w_Image_isCompressed(lua_State *L);
-int w_Image_refresh(lua_State *L);
-int w_Image_getData(lua_State *L);
-int w_Image_getFlags(lua_State *L);
 extern "C" int luaopen_image(lua_State *L);
 
 } // opengl

+ 2 - 2
src/modules/graphics/opengl/wrap_Mesh.cpp

@@ -490,7 +490,7 @@ int w_Mesh_getDrawRange(lua_State *L)
 	return 2;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_Mesh_functions[] =
 {
 	{ "setVertices", w_Mesh_setVertices },
 	{ "setVertex", w_Mesh_setVertex },
@@ -516,7 +516,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_mesh(lua_State *L)
 {
-	return luax_register_type(L, GRAPHICS_MESH_ID, functions);
+	return luax_register_type(L, GRAPHICS_MESH_ID, "Mesh", w_Mesh_functions, nullptr);
 }
 
 } // opengl

+ 0 - 19
src/modules/graphics/opengl/wrap_Mesh.h

@@ -36,25 +36,6 @@ char *luax_writeAttributeData(lua_State *L, int startidx, Mesh::DataType type, i
 const char *luax_readAttributeData(lua_State *L, Mesh::DataType type, int components, const char *data);
 
 Mesh *luax_checkmesh(lua_State *L, int idx);
-int w_Mesh_setVertices(lua_State *L);
-int w_Mesh_setVertex(lua_State *L);
-int w_Mesh_getVertex(lua_State *L);
-int w_Mesh_setVertexAttribute(lua_State *L);
-int w_Mesh_getVertexAttribute(lua_State *L);
-int w_Mesh_getVertexCount(lua_State *L);
-int w_Mesh_getVertexFormat(lua_State *L);
-int w_Mesh_setAttributeEnabled(lua_State *L);
-int w_Mesh_isAttributeEnabled(lua_State *L);
-int w_Mesh_attachAttribute(lua_State *L);
-int w_Mesh_flush(lua_State *L);
-int w_Mesh_setVertexMap(lua_State *L);
-int w_Mesh_getVertexMap(lua_State *L);
-int w_Mesh_setTexture(lua_State *L);
-int w_Mesh_getTexture(lua_State *L);
-int w_Mesh_setDrawMode(lua_State *L);
-int w_Mesh_getDrawMode(lua_State *L);
-int w_Mesh_setDrawRange(lua_State *L);
-int w_Mesh_getDrawRange(lua_State *L);
 extern "C" int luaopen_mesh(lua_State *L);
 
 } // opengl

+ 2 - 2
src/modules/graphics/opengl/wrap_ParticleSystem.cpp

@@ -705,7 +705,7 @@ int w_ParticleSystem_update(lua_State *L)
 	return 0;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_ParticleSystem_functions[] =
 {
 	{ "clone", w_ParticleSystem_clone },
 	{ "setTexture", w_ParticleSystem_setTexture },
@@ -772,7 +772,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_particlesystem(lua_State *L)
 {
-	return luax_register_type(L, GRAPHICS_PARTICLE_SYSTEM_ID, functions);
+	return luax_register_type(L, GRAPHICS_PARTICLE_SYSTEM_ID, "ParticleSystem", w_ParticleSystem_functions, nullptr);
 }
 
 } // opengl

+ 0 - 60
src/modules/graphics/opengl/wrap_ParticleSystem.h

@@ -33,66 +33,6 @@ namespace opengl
 {
 
 ParticleSystem *luax_checkparticlesystem(lua_State *L, int idx);
-int w_ParticleSystem_clone(lua_State *L);
-int w_ParticleSystem_setTexture(lua_State *L);
-int w_ParticleSystem_getTexture(lua_State *L);
-int w_ParticleSystem_setBufferSize(lua_State *L);
-int w_ParticleSystem_getBufferSize(lua_State *L);
-int w_ParticleSystem_setInsertMode(lua_State *L);
-int w_ParticleSystem_getInsertMode(lua_State *L);
-int w_ParticleSystem_setEmissionRate(lua_State *L);
-int w_ParticleSystem_getEmissionRate(lua_State *L);
-int w_ParticleSystem_setEmitterLifetime(lua_State *L);
-int w_ParticleSystem_getEmitterLifetime(lua_State *L);
-int w_ParticleSystem_setParticleLifetime(lua_State *L);
-int w_ParticleSystem_getParticleLifetime(lua_State *L);
-int w_ParticleSystem_setPosition(lua_State *L);
-int w_ParticleSystem_getPosition(lua_State *L);
-int w_ParticleSystem_moveTo(lua_State *L);
-int w_ParticleSystem_setAreaSpread(lua_State *L);
-int w_ParticleSystem_getAreaSpread(lua_State *L);
-int w_ParticleSystem_setDirection(lua_State *L);
-int w_ParticleSystem_getDirection(lua_State *L);
-int w_ParticleSystem_setSpread(lua_State *L);
-int w_ParticleSystem_getSpread(lua_State *L);
-int w_ParticleSystem_setSpeed(lua_State *L);
-int w_ParticleSystem_getSpeed(lua_State *L);
-int w_ParticleSystem_setLinearAcceleration(lua_State *L);
-int w_ParticleSystem_getLinearAcceleration(lua_State *L);
-int w_ParticleSystem_setRadialAcceleration(lua_State *L);
-int w_ParticleSystem_getRadialAcceleration(lua_State *L);
-int w_ParticleSystem_setTangentialAcceleration(lua_State *L);
-int w_ParticleSystem_getTangentialAcceleration(lua_State *L);
-int w_ParticleSystem_setLinearDamping(lua_State *L);
-int w_ParticleSystem_getLinearDamping(lua_State *L);
-int w_ParticleSystem_setSizes(lua_State *L);
-int w_ParticleSystem_getSizes(lua_State *L);
-int w_ParticleSystem_setSizeVariation(lua_State *L);
-int w_ParticleSystem_getSizeVariation(lua_State *L);
-int w_ParticleSystem_setRotation(lua_State *L);
-int w_ParticleSystem_getRotation(lua_State *L);
-int w_ParticleSystem_setSpin(lua_State *L);
-int w_ParticleSystem_getSpin(lua_State *L);
-int w_ParticleSystem_setSpinVariation(lua_State *L);
-int w_ParticleSystem_getSpinVariation(lua_State *L);
-int w_ParticleSystem_setColors(lua_State *L);
-int w_ParticleSystem_getColors(lua_State *L);
-int w_ParticleSystem_setQuads(lua_State *L);
-int w_ParticleSystem_getQuads(lua_State *L);
-int w_ParticleSystem_setOffset(lua_State *L);
-int w_ParticleSystem_getOffset(lua_State *L);
-int w_ParticleSystem_setRelativeRotation(lua_State *L);
-int w_ParticleSystem_hasRelativeRotation(lua_State *L);
-int w_ParticleSystem_getCount(lua_State *L);
-int w_ParticleSystem_start(lua_State *L);
-int w_ParticleSystem_stop(lua_State *L);
-int w_ParticleSystem_pause(lua_State *L);
-int w_ParticleSystem_reset(lua_State *L);
-int w_ParticleSystem_emit(lua_State *L);
-int w_ParticleSystem_isActive(lua_State *L);
-int w_ParticleSystem_isPaused(lua_State *L);
-int w_ParticleSystem_isStopped(lua_State *L);
-int w_ParticleSystem_update(lua_State *L);
 extern "C" int luaopen_particlesystem(lua_State *L);
 
 } // opengl

+ 2 - 2
src/modules/graphics/opengl/wrap_Shader.cpp

@@ -401,7 +401,7 @@ int w_Shader_getExternVariable(lua_State *L)
 	return 3;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_Shader_functions[] =
 {
 	{ "getWarnings", w_Shader_getWarnings },
 	{ "sendInt",     w_Shader_sendInt },
@@ -417,7 +417,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_shader(lua_State *L)
 {
-	return luax_register_type(L, GRAPHICS_SHADER_ID, functions);
+	return luax_register_type(L, GRAPHICS_SHADER_ID, "Shader", w_Shader_functions, nullptr);
 }
 
 } // opengl

+ 0 - 8
src/modules/graphics/opengl/wrap_Shader.h

@@ -33,14 +33,6 @@ namespace opengl
 {
 
 Shader *luax_checkshader(lua_State *L, int idx);
-int w_Shader_getWarnings(lua_State *L);
-int w_Shader_sendInt(lua_State *L);
-int w_Shader_sendFloat(lua_State *L);
-int w_Shader_sendColor(lua_State *L);
-int w_Shader_sendMatrix(lua_State *L);
-int w_Shader_sendTexture(lua_State *L);
-int w_Shader_send(lua_State *L);
-int w_Shader_getExternVariable(lua_State *L);
 extern "C" int luaopen_shader(lua_State *L);
 
 } // opengl

+ 2 - 2
src/modules/graphics/opengl/wrap_SpriteBatch.cpp

@@ -213,7 +213,7 @@ int w_SpriteBatch_attachAttribute(lua_State *L)
 	return 0;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_SpriteBatch_functions[] =
 {
 	{ "add", w_SpriteBatch_add },
 	{ "set", w_SpriteBatch_set },
@@ -232,7 +232,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_spritebatch(lua_State *L)
 {
-	return luax_register_type(L, GRAPHICS_SPRITE_BATCH_ID, functions);
+	return luax_register_type(L, GRAPHICS_SPRITE_BATCH_ID, "SpriteBatch", w_SpriteBatch_functions, nullptr);
 }
 
 } // opengl

+ 0 - 13
src/modules/graphics/opengl/wrap_SpriteBatch.h

@@ -32,19 +32,6 @@ namespace opengl
 {
 
 SpriteBatch *luax_checkspritebatch(lua_State *L, int idx);
-int w_SpriteBatch_add(lua_State *L);
-int w_SpriteBatch_set(lua_State *L);
-int w_SpriteBatch_clear(lua_State *L);
-int w_SpriteBatch_flush(lua_State *L);
-int w_SpriteBatch_setTexture(lua_State *L);
-int w_SpriteBatch_getTexture(lua_State *L);
-int w_SpriteBatch_setColor(lua_State *L);
-int w_SpriteBatch_getColor(lua_State *L);
-int w_SpriteBatch_getCount(lua_State *L);
-int w_SpriteBatch_setBufferSize(lua_State *L);
-int w_SpriteBatch_getBufferSize(lua_State *L);
-int w_SpriteBatch_attachAttribute(lua_State *L);
-
 extern "C" int luaopen_spritebatch(lua_State *L);
 
 } // opengl

+ 2 - 2
src/modules/graphics/opengl/wrap_Text.cpp

@@ -222,7 +222,7 @@ int w_Text_getHeight(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_Text_functions[] =
 {
 	{ "set", w_Text_set },
 	{ "setf", w_Text_setf },
@@ -238,7 +238,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_text(lua_State *L)
 {
-	return luax_register_type(L, GRAPHICS_TEXT_ID, functions);
+	return luax_register_type(L, GRAPHICS_TEXT_ID, "Text", w_Text_functions, nullptr);
 }
 
 } // opengl

+ 0 - 9
src/modules/graphics/opengl/wrap_Text.h

@@ -33,15 +33,6 @@ namespace opengl
 
 Text *luax_checktext(lua_State *L, int idx);
 void luax_checkcoloredstring(lua_State *L, int idx, std::vector<Font::ColoredString> &strings);
-int w_Text_set(lua_State *L);
-int w_Text_setf(lua_State *L);
-int w_Text_add(lua_State *L);
-int w_Text_addf(lua_State *L);
-int w_Text_clear(lua_State *L);
-int w_Text_setFont(lua_State *L);
-int w_Text_getFont(lua_State *L);
-int w_Text_getWidth(lua_State *L);
-int w_Text_getHeight(lua_State *L);
 extern "C" int luaopen_text(lua_State *L);
 
 } // opengl

+ 2 - 2
src/modules/graphics/wrap_Quad.cpp

@@ -64,7 +64,7 @@ int w_Quad_getViewport(lua_State *L)
 	return 4;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_Quad_functions[] =
 {
 	{ "setViewport", w_Quad_setViewport },
 	{ "getViewport", w_Quad_getViewport },
@@ -73,7 +73,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_quad(lua_State *L)
 {
-	return luax_register_type(L, GRAPHICS_QUAD_ID, functions);
+	return luax_register_type(L, GRAPHICS_QUAD_ID, "Quad", w_Quad_functions, nullptr);
 }
 
 } // graphics

+ 0 - 2
src/modules/graphics/wrap_Quad.h

@@ -31,8 +31,6 @@ namespace graphics
 {
 
 Quad *luax_checkquad(lua_State *L, int idx);
-int w_Quad_setViewport(lua_State *L);
-int w_Quad_getViewport(lua_State *L);
 extern "C" int luaopen_quad(lua_State *L);
 
 } // graphics

+ 17 - 0
src/modules/graphics/wrap_Texture.cpp

@@ -125,5 +125,22 @@ int w_Texture_getWrap(lua_State *L)
 	return 2;
 }
 
+const luaL_Reg w_Texture_functions[] =
+{
+	{ "getWidth", w_Texture_getWidth },
+	{ "getHeight", w_Texture_getHeight },
+	{ "getDimensions", w_Texture_getDimensions },
+	{ "setFilter", w_Texture_setFilter },
+	{ "getFilter", w_Texture_getFilter },
+	{ "setWrap", w_Texture_setWrap },
+	{ "getWrap", w_Texture_getWrap },
+	{ 0, 0 }
+};
+
+extern "C" int luaopen_texture(lua_State *L)
+{
+	return luax_register_type(L, GRAPHICS_TEXTURE_ID, "Texture", w_Texture_functions, nullptr);
+}
+
 } // graphics
 } // love

+ 3 - 7
src/modules/graphics/wrap_Texture.h

@@ -30,13 +30,9 @@ namespace graphics
 {
 
 Texture *luax_checktexture(lua_State *L, int idx);
-int w_Texture_getWidth(lua_State *L);
-int w_Texture_getHeight(lua_State *L);
-int w_Texture_getDimensions(lua_State *L);
-int w_Texture_setFilter(lua_State *L);
-int w_Texture_getFilter(lua_State *L);
-int w_Texture_setWrap(lua_State *L);
-int w_Texture_getWrap(lua_State *L);
+extern "C" int luaopen_texture(lua_State *L);
+
+extern const luaL_Reg w_Texture_functions[];
 
 } // graphics
 } // love

+ 12 - 8
src/modules/image/magpie/Image.cpp

@@ -41,14 +41,18 @@ namespace magpie
 
 Image::Image()
 {
-	formatHandlers.push_back(new PNGHandler);
-	formatHandlers.push_back(new STBHandler);
-
-	compressedFormatHandlers.push_back(new DDSHandler);
-	compressedFormatHandlers.push_back(new PVRHandler);
-	compressedFormatHandlers.push_back(new KTXHandler);
-	compressedFormatHandlers.push_back(new PKMHandler);
-	compressedFormatHandlers.push_back(new ASTCHandler);
+	formatHandlers = {
+		new PNGHandler,
+		new STBHandler,
+	};
+
+	compressedFormatHandlers = {
+		new DDSHandler,
+		new PVRHandler,
+		new KTXHandler,
+		new PKMHandler,
+		new ASTCHandler,
+	};
 }
 
 Image::~Image()

+ 2 - 7
src/modules/image/wrap_CompressedImageData.cpp

@@ -94,13 +94,8 @@ int w_CompressedImageData_getFormat(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_CompressedImageData_functions[] =
 {
-	// Data
-	{ "getString", w_Data_getString },
-	{ "getPointer", w_Data_getPointer },
-	{ "getSize", w_Data_getSize },
-
 	{ "getWidth", w_CompressedImageData_getWidth },
 	{ "getHeight", w_CompressedImageData_getHeight },
 	{ "getDimensions", w_CompressedImageData_getDimensions },
@@ -111,7 +106,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_compressedimagedata(lua_State *L)
 {
-	return luax_register_type(L, IMAGE_COMPRESSED_IMAGE_DATA_ID, functions);
+	return luax_register_type(L, IMAGE_COMPRESSED_IMAGE_DATA_ID, "CompressedImageData", w_Data_functions, w_CompressedImageData_functions, nullptr);
 }
 
 } // image

+ 0 - 5
src/modules/image/wrap_CompressedImageData.h

@@ -31,11 +31,6 @@ namespace image
 {
 
 CompressedImageData *luax_checkcompressedimagedata(lua_State *L, int idx);
-int w_CompressedImageData_getWidth(lua_State *L);
-int w_CompressedImageData_getHeight(lua_State *L);
-int w_CompressedImageData_getDimensions(lua_State *L);
-int w_CompressedImageData_getMipmapCount(lua_State *L);
-int w_CompressedImageData_getFormat(lua_State *L);
 extern "C" int luaopen_compressedimagedata(lua_State *L);
 
 } // image

+ 0 - 3
src/modules/image/wrap_Image.h

@@ -31,9 +31,6 @@ namespace love
 namespace image
 {
 
-int w_newImageData(lua_State *L);
-int w_newCompressedData(lua_State *L);
-int w_isCompressed(lua_State *L);
 extern "C" LOVE_EXPORT int luaopen_love_image(lua_State *L);
 
 } // image

+ 10 - 15
src/modules/image/wrap_ImageData.cpp

@@ -279,7 +279,7 @@ struct FFI_ImageData
 
 static FFI_ImageData ffifuncs =
 {
-	[](Proxy *p) -> void // lockMutex
+	[](Proxy *p) // lockMutex
 	{
 		// We don't do any type-checking for the Proxy here since these functions
 		// are always called from code which has already done type checking.
@@ -287,20 +287,15 @@ static FFI_ImageData ffifuncs =
 		i->getMutex()->lock();
 	},
 
-	[](Proxy *p) -> void // unlockMutex
+	[](Proxy *p) // unlockMutex
 	{
 		ImageData *i = (ImageData *) p->object;
 		i->getMutex()->unlock();
 	}
 };
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_ImageData_functions[] =
 {
-	// Data
-	{ "getString", w_Data_getString },
-	{ "getPointer", w_Data_getPointer },
-	{ "getSize", w_Data_getSize },
-
 	{ "getWidth", w_ImageData_getWidth },
 	{ "getHeight", w_ImageData_getHeight },
 	{ "getDimensions", w_ImageData_getDimensions },
@@ -318,23 +313,23 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_imagedata(lua_State *L)
 {
-	// The last argument pushes the type's metatable onto the stack.
-	int ret = luax_register_type(L, IMAGE_IMAGE_DATA_ID, functions, true);
+	int ret = luax_register_type(L, IMAGE_IMAGE_DATA_ID, "ImageData", w_Data_functions, w_ImageData_functions, nullptr);
+
+	luax_gettypemetatable(L, IMAGE_IMAGE_DATA_ID);
 
 	// Load and execute ImageData.lua, sending the metatable and the ffi
 	// functions struct pointer as arguments.
-	if (ret > 0)
+	if (lua_istable(L, -1))
 	{
 		luaL_loadbuffer(L, imagedata_lua, sizeof(imagedata_lua), "ImageData.lua");
 		lua_pushvalue(L, -2);
 		lua_pushlightuserdata(L, &ffifuncs);
 		lua_call(L, 2, 0);
-
-		// Pop the metatable.
-		lua_pop(L, 1);
-		ret--;
 	}
 
+	// Pop the metatable.
+	lua_pop(L, 1);
+
 	return ret;
 }
 

+ 0 - 8
src/modules/image/wrap_ImageData.h

@@ -31,14 +31,6 @@ namespace image
 {
 
 ImageData *luax_checkimagedata(lua_State *L, int idx);
-int w_ImageData_getWidth(lua_State *L);
-int w_ImageData_getHeight(lua_State *L);
-int w_ImageData_getDimensions(lua_State *L);
-int w_ImageData_getPixel(lua_State *L);
-int w_ImageData_setPixel(lua_State *L);
-int w_ImageData_mapPixel(lua_State *L);
-int w_ImageData_paste(lua_State *L);
-int w_ImageData_encode(lua_State *L);
 extern "C" int luaopen_imagedata(lua_State *L);
 
 } // image

+ 2 - 2
src/modules/joystick/wrap_Joystick.cpp

@@ -224,7 +224,7 @@ int w_Joystick_getVibration(lua_State *L)
 }
 
 // List of functions to wrap.
-static const luaL_Reg functions[] =
+static const luaL_Reg w_Joystick_functions[] =
 {
 	{ "isConnected", w_Joystick_isConnected },
 	{ "getName", w_Joystick_getName },
@@ -255,7 +255,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_joystick(lua_State *L)
 {
-	return luax_register_type(L, JOYSTICK_JOYSTICK_ID, functions);
+	return luax_register_type(L, JOYSTICK_JOYSTICK_ID, "Joystick", w_Joystick_functions, nullptr);
 }
 
 } // joystick

+ 0 - 17
src/modules/joystick/wrap_Joystick.h

@@ -32,23 +32,6 @@ namespace joystick
 {
 
 Joystick *luax_checkjoystick(lua_State *L, int idx);
-int w_Joystick_isConnected(lua_State *L);
-int w_Joystick_getName(lua_State *L);
-int w_Joystick_getID(lua_State *L);
-int w_Joystick_getGUID(lua_State *L);
-int w_Joystick_getAxisCount(lua_State *L);
-int w_Joystick_getButtonCount(lua_State *L);
-int w_Joystick_getHatCount(lua_State *L);
-int w_Joystick_getAxis(lua_State *L);
-int w_Joystick_getAxes(lua_State *L);
-int w_Joystick_getHat(lua_State *L);
-int w_Joystick_isDown(lua_State *L);
-int w_Joystick_isGamepad(lua_State *L);
-int w_Joystick_getGamepadAxis(lua_State *L);
-int w_Joystick_isGamepadDown(lua_State *L);
-int w_Joystick_isVibrationSupported(lua_State *L);
-int w_Joystick_setVibration(lua_State *L);
-int w_Joystick_getVibration(lua_State *L);
 extern "C" int luaopen_joystick(lua_State *L);
 
 } // joystick

+ 0 - 5
src/modules/joystick/wrap_JoystickModule.h

@@ -31,13 +31,8 @@ namespace love
 namespace joystick
 {
 
-int w_getJoysticks(lua_State *L);
 int w_getIndex(lua_State *L);
-int w_getJoystickCount(lua_State *L);
-int w_setGamepadMapping(lua_State *L);
 int w_getGamepadMapping(lua_State *L);
-int w_loadGamepadMappings(lua_State *L);
-int w_saveGamepadMappings(lua_State *L);
 extern "C" LOVE_EXPORT int luaopen_love_joystick(lua_State *L);
 
 } // joystick

+ 0 - 9
src/modules/keyboard/wrap_Keyboard.h

@@ -30,15 +30,6 @@ namespace love
 namespace keyboard
 {
 
-int w_setKeyRepeat(lua_State *L);
-int w_hasKeyRepeat(lua_State *L);
-int w_isDown(lua_State *L);
-int w_isScancodeDown(lua_State *L);
-int w_getKeyFromScancode(lua_State *L);
-int w_getScancodeFromKey(lua_State *L);
-int w_setTextInput(lua_State *L);
-int w_hasTextInput(lua_State *L);
-int w_hasScreenKeyboard(lua_State *L);
 extern "C" LOVE_EXPORT int luaopen_love_keyboard(lua_State *L);
 
 } // keyboard

+ 4 - 0
src/modules/love/love.cpp

@@ -22,6 +22,7 @@
 #include "common/config.h"
 #include "common/version.h"
 #include "common/runtime.h"
+#include "common/wrap_Data.h"
 
 #include "love.h"
 
@@ -319,6 +320,9 @@ int luaopen_love(lua_State *L)
 	for (int i = 0; modules[i].name != nullptr; i++)
 		love::luax_preload(L, modules[i].func, modules[i].name);
 
+	// Load "common" types.
+	love::w_Data_open(L);
+
 #ifdef LOVE_ENABLE_LUASOCKET
 	love::luasocket::__open(L);
 #endif

+ 2 - 2
src/modules/math/wrap_BezierCurve.cpp

@@ -213,7 +213,7 @@ int w_BezierCurve_renderSegment(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_BezierCurve_functions[] =
 {
 	{"getDegree", w_BezierCurve_getDegree},
 	{"getDerivative", w_BezierCurve_getDerivative},
@@ -234,7 +234,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_beziercurve(lua_State *L)
 {
-	return luax_register_type(L, MATH_BEZIER_CURVE_ID, functions);
+	return luax_register_type(L, MATH_BEZIER_CURVE_ID, "BezierCurve", w_BezierCurve_functions, nullptr);
 }
 
 } // math

+ 0 - 14
src/modules/math/wrap_BezierCurve.h

@@ -31,20 +31,6 @@ namespace math
 {
 
 BezierCurve *luax_checkbeziercurve(lua_State *L, int idx);
-int w_BezierCurve_getDegree(lua_State *L);
-int w_BezierCurve_getDerivative(lua_State *L);
-int w_BezierCurve_getControlPoint(lua_State *L);
-int w_BezierCurve_setControlPoint(lua_State *L);
-int w_BezierCurve_insertControlPoint(lua_State *L);
-int w_BezierCurve_removeControlPoint(lua_State *L);
-int w_BezierCurve_getControlPointCount(lua_State *L);
-int w_BezierCurve_translate(lua_State *L);
-int w_BezierCurve_rotate(lua_State *L);
-int w_BezierCurve_scale(lua_State *L);
-int w_BezierCurve_evaluate(lua_State *L);
-int w_BezierCurve_getSegment(lua_State *L);
-int w_BezierCurve_render(lua_State *L);
-int w_BezierCurve_renderSegment(lua_State *L);
 extern "C" int luaopen_beziercurve(lua_State *L);
 
 } // math

+ 2 - 7
src/modules/math/wrap_CompressedData.cpp

@@ -44,13 +44,8 @@ int w_CompressedData_getFormat(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_CompressedData_functions[] =
 {
-	// Data
-	{ "getString", w_Data_getString },
-	{ "getPointer", w_Data_getPointer },
-	{ "getSize", w_Data_getSize },
-
 	{ "getFormat", w_CompressedData_getFormat },
 	{ 0, 0 },
 };
@@ -58,7 +53,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_compresseddata(lua_State *L)
 {
-	return luax_register_type(L, MATH_COMPRESSED_DATA_ID, functions);
+	return luax_register_type(L, MATH_COMPRESSED_DATA_ID, "CompressedData", w_Data_functions, w_CompressedData_functions, nullptr);
 }
 
 } // math

+ 0 - 1
src/modules/math/wrap_CompressedData.h

@@ -31,7 +31,6 @@ namespace math
 {
 
 CompressedData *luax_checkcompresseddata(lua_State *L, int idx);
-int w_CompressedData_getFormat(lua_State *L);
 extern "C" int luaopen_compresseddata(lua_State *L);
 
 } // math

+ 0 - 15
src/modules/math/wrap_Math.h

@@ -30,21 +30,6 @@ namespace love
 namespace math
 {
 
-int w_random(lua_State *L);
-int w_randomNormal(lua_State *L);
-int w_setRandomSeed(lua_State *L);
-int w_getRandomSeed(lua_State *L);
-int w_setRandomState(lua_State *L);
-int w_getRandomState(lua_State *L);
-int w_newRandomGenerator(lua_State *L);
-int w_newBezierCurve(lua_State *L);
-int w_triangulate(lua_State *L);
-int w_isConvex(lua_State *L);
-int w_gammaToLinear(lua_State *L);
-int w_linearToGamma(lua_State *L);
-int w_noise(lua_State *L);
-int w_compress(lua_State *L);
-int w_decompress(lua_State *L);
 extern "C" LOVE_EXPORT int luaopen_love_math(lua_State *L);
 
 } // random

+ 2 - 2
src/modules/math/wrap_RandomGenerator.cpp

@@ -135,7 +135,7 @@ int w_RandomGenerator_getState(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_RandomGenerator_functions[] =
 {
 	{ "random", w_RandomGenerator_random },
 	{ "randomNormal", w_RandomGenerator_randomNormal },
@@ -148,7 +148,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_randomgenerator(lua_State *L)
 {
-	return luax_register_type(L, MATH_RANDOM_GENERATOR_ID, functions);
+	return luax_register_type(L, MATH_RANDOM_GENERATOR_ID, "RandomGenerator", w_RandomGenerator_functions, nullptr);
 }
 
 } // math

+ 0 - 6
src/modules/math/wrap_RandomGenerator.h

@@ -36,12 +36,6 @@ RandomGenerator::Seed luax_checkrandomseed(lua_State *L, int idx);
 int luax_getrandom(lua_State *L, int startidx, double r);
 
 RandomGenerator *luax_checkrandomgenerator(lua_State *L, int idx);
-int w_RandomGenerator_random(lua_State *L);
-int w_RandomGenerator_randomNormal(lua_State *L);
-int w_RandomGenerator_setSeed(lua_State *L);
-int w_RandomGenerator_getSeed(lua_State *L);
-int w_RandomGenerator_setState(lua_State *L);
-int w_RandomGenerator_getState(lua_State *L);
 extern "C" int luaopen_randomgenerator(lua_State *L);
 
 } // math

+ 2 - 2
src/modules/mouse/wrap_Cursor.cpp

@@ -53,7 +53,7 @@ int w_Cursor_getType(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_Cursor_functions[] =
 {
 	{ "getType", w_Cursor_getType },
 	{ 0, 0 },
@@ -61,7 +61,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_cursor(lua_State *L)
 {
-	return luax_register_type(L, MOUSE_CURSOR_ID, functions);
+	return luax_register_type(L, MOUSE_CURSOR_ID, "Cursor", w_Cursor_functions, nullptr);
 }
 
 } // mouse

+ 0 - 1
src/modules/mouse/wrap_Cursor.h

@@ -31,7 +31,6 @@ namespace mouse
 {
 
 Cursor *luax_checkcursor(lua_State *L, int idx);
-int w_Cursor_getType(lua_State *L);
 extern "C" int luaopen_cursor(lua_State *L);
 
 } // mouse

+ 0 - 18
src/modules/mouse/wrap_Mouse.h

@@ -30,24 +30,6 @@ namespace love
 namespace mouse
 {
 
-int w_newCursor(lua_State *L);
-int w_getSystemCursor(lua_State *L);
-int w_setCursor(lua_State *L);
-int w_getCursor(lua_State *L);
-int w_hasCursor(lua_State *L);
-int w_getX(lua_State *L);
-int w_getY(lua_State *L);
-int w_getPosition(lua_State *L);
-int w_setX(lua_State *L);
-int w_setY(lua_State *L);
-int w_setPosition(lua_State *L);
-int w_isDown(lua_State *L);
-int w_setVisible(lua_State *L);
-int w_isVisible(lua_State *L);
-int w_setGrabbed(lua_State *L);
-int w_isGrabbed(lua_State *L);
-int w_setRelativeMode(lua_State *L);
-int w_getRelativeMode(lua_State *L);
 extern "C" LOVE_EXPORT int luaopen_love_mouse(lua_State *L);
 
 } // mouse

+ 2 - 2
src/modules/physics/box2d/wrap_Body.cpp

@@ -585,7 +585,7 @@ int w_Body_getUserData(lua_State *L)
 	return t->getUserData(L);
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_Body_functions[] =
 {
 	{ "getX", w_Body_getX },
 	{ "getY", w_Body_getY },
@@ -650,7 +650,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_body(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_BODY_ID, functions);
+	return luax_register_type(L, PHYSICS_BODY_ID, "Body", w_Body_functions, nullptr);
 }
 
 } // box2d

+ 0 - 58
src/modules/physics/box2d/wrap_Body.h

@@ -33,64 +33,6 @@ namespace box2d
 {
 
 Body *luax_checkbody(lua_State *L, int idx);
-int w_Body_getX(lua_State *L);
-int w_Body_getY(lua_State *L);
-int w_Body_getAngle(lua_State *L);
-int w_Body_getPosition(lua_State *L);
-int w_Body_getLinearVelocity(lua_State *L);
-int w_Body_getWorldCenter(lua_State *L);
-int w_Body_getLocalCenter(lua_State *L);
-int w_Body_getAngularVelocity(lua_State *L);
-int w_Body_getMass(lua_State *L);
-int w_Body_getInertia(lua_State *L);
-int w_Body_getMassData(lua_State *L);
-int w_Body_getAngularDamping(lua_State *L);
-int w_Body_getLinearDamping(lua_State *L);
-int w_Body_getGravityScale(lua_State *L);
-int w_Body_getType(lua_State *L);
-int w_Body_applyLinearImpulse(lua_State *L);
-int w_Body_applyAngularImpulse(lua_State *L);
-int w_Body_applyTorque(lua_State *L);
-int w_Body_applyForce(lua_State *L);
-int w_Body_setX(lua_State *L);
-int w_Body_setY(lua_State *L);
-int w_Body_setLinearVelocity(lua_State *L);
-int w_Body_setAngle(lua_State *L);
-int w_Body_setAngularVelocity(lua_State *L);
-int w_Body_setPosition(lua_State *L);
-int w_Body_resetMassData(lua_State *L);
-int w_Body_setMassData(lua_State *L);
-int w_Body_setMass(lua_State *L);
-int w_Body_setInertia(lua_State *L);
-int w_Body_setAngularDamping(lua_State *L);
-int w_Body_setLinearDamping(lua_State *L);
-int w_Body_setGravityScale(lua_State *L);
-int w_Body_setType(lua_State *L);
-int w_Body_getWorldPoint(lua_State *L);
-int w_Body_getWorldVector(lua_State *L);
-int w_Body_getWorldPoints(lua_State *L);
-int w_Body_getLocalPoint(lua_State *L);
-int w_Body_getLocalVector(lua_State *L);
-int w_Body_getLinearVelocityFromWorldPoint(lua_State *L);
-int w_Body_getLinearVelocityFromLocalPoint(lua_State *L);
-int w_Body_isBullet(lua_State *L);
-int w_Body_setBullet(lua_State *L);
-int w_Body_isActive(lua_State *L);
-int w_Body_isAwake(lua_State *L);
-int w_Body_setSleepingAllowed(lua_State *L);
-int w_Body_isSleepingAllowed(lua_State *L);
-int w_Body_setActive(lua_State *L);
-int w_Body_setAwake(lua_State *L);
-int w_Body_setFixedRotation(lua_State *L);
-int w_Body_isFixedRotation(lua_State *L);
-int w_Body_getWorld(lua_State *L);
-int w_Body_getFixtureList(lua_State *L);
-int w_Body_getJointList(lua_State *L);
-int w_Body_getContactList(lua_State *L);
-int w_Body_destroy(lua_State *L);
-int w_Body_isDestroyed(lua_State *L);
-int w_Body_setUserData(lua_State *L);
-int w_Body_getUserData(lua_State *L);
 extern "C" int luaopen_body(lua_State *L);
 
 } // box2d

+ 2 - 10
src/modules/physics/box2d/wrap_ChainShape.cpp

@@ -98,7 +98,7 @@ int w_ChainShape_getPoints(lua_State *L)
 	return count*2;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_ChainShape_functions[] =
 {
 	{ "setNextVertex", w_ChainShape_setNextVertex },
 	{ "setPreviousVertex", w_ChainShape_setPreviousVertex },
@@ -106,20 +106,12 @@ static const luaL_Reg functions[] =
 	{ "getVertexCount", w_ChainShape_getVertexCount },
 	{ "getPoint", w_ChainShape_getPoint },
 	{ "getPoints", w_ChainShape_getPoints },
-	// From Shape.
-	{ "getType", w_Shape_getType },
-	{ "getRadius", w_Shape_getRadius },
-	{ "getChildCount", w_Shape_getChildCount },
-	{ "testPoint", w_Shape_testPoint },
-	{ "rayCast", w_Shape_rayCast },
-	{ "computeAABB", w_Shape_computeAABB },
-	{ "computeMass", w_Shape_computeMass },
 	{ 0, 0 }
 };
 
 extern "C" int luaopen_chainshape(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_CHAIN_SHAPE_ID, functions);
+	return luax_register_type(L, PHYSICS_CHAIN_SHAPE_ID, "ChainShape", w_Shape_functions, w_ChainShape_functions, nullptr);
 }
 
 } // box2d

+ 0 - 8
src/modules/physics/box2d/wrap_ChainShape.h

@@ -34,14 +34,6 @@ namespace box2d
 {
 
 ChainShape *luax_checkchainshape(lua_State *L, int idx);
-
-int w_ChainShape_setNextVertex(lua_State *L);
-int w_ChainShape_setPreviousVertex(lua_State *L);
-int w_ChainShape_getChildEdge(lua_State *L);
-int w_ChainShape_getVertexCount(lua_State *L);
-int w_ChainShape_getPoint(lua_State *L);
-int w_ChainShape_getPoints(lua_State *L);
-
 extern "C" int luaopen_chainshape(lua_State *L);
 
 } // box2d

+ 2 - 10
src/modules/physics/box2d/wrap_CircleShape.cpp

@@ -64,26 +64,18 @@ int w_CircleShape_setPoint(lua_State *L)
 	return 0;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_CircleShape_functions[] =
 {
 	{ "getRadius", w_CircleShape_getRadius },
 	{ "setRadius", w_CircleShape_setRadius },
 	{ "getPoint", w_CircleShape_getPoint },
 	{ "setPoint", w_CircleShape_setPoint },
-	// From Shape.
-	{ "getType", w_Shape_getType },
-	{ "getRadius", w_Shape_getRadius },
-	{ "getChildCount", w_Shape_getChildCount },
-	{ "testPoint", w_Shape_testPoint },
-	{ "rayCast", w_Shape_rayCast },
-	{ "computeAABB", w_Shape_computeAABB },
-	{ "computeMass", w_Shape_computeMass },
 	{ 0, 0 }
 };
 
 extern "C" int luaopen_circleshape(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_CIRCLE_SHAPE_ID, functions);
+	return luax_register_type(L, PHYSICS_CIRCLE_SHAPE_ID, "CircleShape", w_Shape_functions, w_CircleShape_functions, nullptr);
 }
 
 } // box2d

+ 0 - 4
src/modules/physics/box2d/wrap_CircleShape.h

@@ -34,10 +34,6 @@ namespace box2d
 {
 
 CircleShape *luax_checkcircleshape(lua_State *L, int idx);
-int w_CircleShape_getRadius(lua_State *L);
-int w_CircleShape_setRadius(lua_State *L);
-int w_CircleShape_getPoint(lua_State *L);
-int w_CircleShape_setPoint(lua_State *L);
 extern "C" int luaopen_circleshape(lua_State *L);
 
 } // box2d

+ 22 - 22
src/modules/physics/box2d/wrap_Contact.cpp

@@ -158,30 +158,30 @@ int w_Contact_isDestroyed(lua_State *L)
 	return 1;
 }
 
+static const luaL_Reg w_Contact_functions[] =
+{
+	{ "getPositions", w_Contact_getPositions },
+	{ "getNormal", w_Contact_getNormal },
+	{ "getFriction", w_Contact_getFriction },
+	{ "getRestitution", w_Contact_getRestitution },
+	{ "isEnabled", w_Contact_isEnabled },
+	{ "isTouching", w_Contact_isTouching },
+	{ "setFriction", w_Contact_setFriction },
+	{ "setRestitution", w_Contact_setRestitution },
+	{ "setEnabled", w_Contact_setEnabled },
+	{ "resetFriction", w_Contact_resetFriction },
+	{ "resetRestitution", w_Contact_resetRestitution },
+	{ "setTangentSpeed", w_Contact_setTangentSpeed },
+	{ "getTangentSpeed", w_Contact_getTangentSpeed },
+	{ "getChildren", w_Contact_getChildren },
+	{ "getFixtures", w_Contact_getFixtures },
+	{ "isDestroyed", w_Contact_isDestroyed },
+	{ 0, 0 }
+};
+
 extern "C" int luaopen_contact(lua_State *L)
 {
-	static const luaL_Reg functions[] =
-	{
-		{ "getPositions", w_Contact_getPositions },
-		{ "getNormal", w_Contact_getNormal },
-		{ "getFriction", w_Contact_getFriction },
-		{ "getRestitution", w_Contact_getRestitution },
-		{ "isEnabled", w_Contact_isEnabled },
-		{ "isTouching", w_Contact_isTouching },
-		{ "setFriction", w_Contact_setFriction },
-		{ "setRestitution", w_Contact_setRestitution },
-		{ "setEnabled", w_Contact_setEnabled },
-		{ "resetFriction", w_Contact_resetFriction },
-		{ "resetRestitution", w_Contact_resetRestitution },
-		{ "setTangentSpeed", w_Contact_setTangentSpeed },
-		{ "getTangentSpeed", w_Contact_getTangentSpeed },
-		{ "getChildren", w_Contact_getChildren },
-		{ "getFixtures", w_Contact_getFixtures },
-		{ "isDestroyed", w_Contact_isDestroyed },
-		{ 0, 0 }
-	};
-
-	return luax_register_type(L, PHYSICS_CONTACT_ID, functions);
+	return luax_register_type(L, PHYSICS_CONTACT_ID, "Contact", w_Contact_functions, nullptr);
 }
 
 } // box2d

+ 0 - 16
src/modules/physics/box2d/wrap_Contact.h

@@ -33,22 +33,6 @@ namespace box2d
 {
 
 Contact *luax_checkcontact(lua_State *L, int idx);
-int w_Contact_getPositions(lua_State *L);
-int w_Contact_getNormal(lua_State *L);
-int w_Contact_getFriction(lua_State *L);
-int w_Contact_getRestitution(lua_State *L);
-int w_Contact_isEnabled(lua_State *L);
-int w_Contact_isTouching(lua_State *L);
-int w_Contact_setFriction(lua_State *L);
-int w_Contact_setRestitution(lua_State *L);
-int w_Contact_setEnabled(lua_State *L);
-int w_Contact_resetFriction(lua_State *L);
-int w_Contact_resetRestitution(lua_State *L);
-int w_Contact_setTangentSpeed(lua_State *L);
-int w_Contact_getTangentSpeed(lua_State *L);
-int w_Contact_getChildren(lua_State *L);
-int w_Contact_getFixtures(lua_State *L);
-int w_Contact_isDestroyed(lua_State *L);
 extern "C" int luaopen_contact(lua_State *L);
 
 } // box2d

+ 2 - 13
src/modules/physics/box2d/wrap_DistanceJoint.cpp

@@ -80,7 +80,7 @@ int w_DistanceJoint_getDampingRatio(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_DistanceJoint_functions[] =
 {
 	{ "setLength", w_DistanceJoint_setLength },
 	{ "getLength", w_DistanceJoint_getLength },
@@ -88,23 +88,12 @@ static const luaL_Reg functions[] =
 	{ "getFrequency", w_DistanceJoint_getFrequency },
 	{ "setDampingRatio", w_DistanceJoint_setDampingRatio },
 	{ "getDampingRatio", w_DistanceJoint_getDampingRatio },
-	// From Joint.
-	{ "getType", w_Joint_getType },
-	{ "getBodies", w_Joint_getBodies },
-	{ "getAnchors", w_Joint_getAnchors },
-	{ "getReactionForce", w_Joint_getReactionForce },
-	{ "getReactionTorque", w_Joint_getReactionTorque },
-	{ "getCollideConnected", w_Joint_getCollideConnected },
-	{ "setUserData", w_Joint_setUserData },
-	{ "getUserData", w_Joint_getUserData },
-	{ "destroy", w_Joint_destroy },
-	{ "isDestroyed", w_Joint_isDestroyed },
 	{ 0, 0 }
 };
 
 extern "C" int luaopen_distancejoint(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_DISTANCE_JOINT_ID, functions);
+	return luax_register_type(L, PHYSICS_DISTANCE_JOINT_ID, "DistanceJoint", w_Joint_functions, w_DistanceJoint_functions, nullptr);
 }
 
 } // box2d

+ 0 - 6
src/modules/physics/box2d/wrap_DistanceJoint.h

@@ -34,12 +34,6 @@ namespace box2d
 {
 
 DistanceJoint *luax_checkdistancejoint(lua_State *L, int idx);
-int w_DistanceJoint_setLength(lua_State *L);
-int w_DistanceJoint_getLength(lua_State *L);
-int w_DistanceJoint_setFrequency(lua_State *L);
-int w_DistanceJoint_getFrequency(lua_State *L);
-int w_DistanceJoint_setDampingRatio(lua_State *L);
-int w_DistanceJoint_getDampingRatio(lua_State *L);
 extern "C" int luaopen_distancejoint(lua_State *L);
 
 } // box2d

+ 2 - 10
src/modules/physics/box2d/wrap_EdgeShape.cpp

@@ -39,23 +39,15 @@ int w_EdgeShape_getPoints(lua_State *L)
 	return t->getPoints(L);
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_EdgeShape_functions[] =
 {
 	{ "getPoints", w_EdgeShape_getPoints },
-	// From Shape.
-	{ "getType", w_Shape_getType },
-	{ "getRadius", w_Shape_getRadius },
-	{ "getChildCount", w_Shape_getChildCount },
-	{ "testPoint", w_Shape_testPoint },
-	{ "rayCast", w_Shape_rayCast },
-	{ "computeAABB", w_Shape_computeAABB },
-	{ "computeMass", w_Shape_computeMass },
 	{ 0, 0 }
 };
 
 extern "C" int luaopen_edgeshape(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_EDGE_SHAPE_ID, functions);
+	return luax_register_type(L, PHYSICS_EDGE_SHAPE_ID, "EdgeShape", w_Shape_functions, w_EdgeShape_functions, nullptr);
 }
 
 } // box2d

+ 0 - 1
src/modules/physics/box2d/wrap_EdgeShape.h

@@ -34,7 +34,6 @@ namespace box2d
 {
 
 EdgeShape *luax_checkedgeshape(lua_State *L, int idx);
-int w_EdgeShape_getPoints(lua_State *L);
 extern "C" int luaopen_edgeshape(lua_State *L);
 
 } // box2d

+ 2 - 2
src/modules/physics/box2d/wrap_Fixture.cpp

@@ -269,7 +269,7 @@ int w_Fixture_isDestroyed(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_Fixture_functions[] =
 {
 	{ "getType", w_Fixture_getType },
 	{ "setFriction", w_Fixture_setFriction },
@@ -303,7 +303,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_fixture(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_FIXTURE_ID, functions);
+	return luax_register_type(L, PHYSICS_FIXTURE_ID, "Fixture", w_Fixture_functions, nullptr);
 }
 
 } // box2d

+ 0 - 27
src/modules/physics/box2d/wrap_Fixture.h

@@ -34,33 +34,6 @@ namespace box2d
 {
 
 Fixture *luax_checkfixture(lua_State *L, int idx);
-int w_Fixture_getType(lua_State *L);
-int w_Fixture_setFriction(lua_State *L);
-int w_Fixture_setRestitution(lua_State *L);
-int w_Fixture_setDensity(lua_State *L);
-int w_Fixture_setSensor(lua_State *L);
-int w_Fixture_getFriction(lua_State *L);
-int w_Fixture_getRestitution(lua_State *L);
-int w_Fixture_getDensity(lua_State *L);
-int w_Fixture_isSensor(lua_State *L);
-int w_Fixture_getBody(lua_State *L);
-int w_Fixture_getShape(lua_State *L);
-int w_Fixture_testPoint(lua_State *L);
-int w_Fixture_rayCast(lua_State *L);
-int w_Fixture_setFilterData(lua_State *L);
-int w_Fixture_getFilterData(lua_State *L);
-int w_Fixture_setCategory(lua_State *L);
-int w_Fixture_getCategory(lua_State *L);
-int w_Fixture_setMask(lua_State *L);
-int w_Fixture_getMask(lua_State *L);
-int w_Fixture_setUserData(lua_State *L);
-int w_Fixture_getUserData(lua_State *L);
-int w_Fixture_getBoundingBox(lua_State *L);
-int w_Fixture_getMassData(lua_State *L);
-int w_Fixture_getGroupIndex(lua_State *L);
-int w_Fixture_setGroupIndex(lua_State *L);
-int w_Fixture_destroy(lua_State *L);
-int w_Fixture_isDestroyed(lua_State *L);
 extern "C" int luaopen_fixture(lua_State *L);
 
 } // box2d

+ 2 - 13
src/modules/physics/box2d/wrap_FrictionJoint.cpp

@@ -66,29 +66,18 @@ int w_FrictionJoint_getMaxTorque(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_FrictionJoint_functions[] =
 {
 	{ "setMaxForce", w_FrictionJoint_setMaxForce },
 	{ "getMaxForce", w_FrictionJoint_getMaxForce },
 	{ "setMaxTorque", w_FrictionJoint_setMaxTorque },
 	{ "getMaxTorque", w_FrictionJoint_getMaxTorque },
-	// From Joint.
-	{ "getType", w_Joint_getType },
-	{ "getBodies", w_Joint_getBodies },
-	{ "getAnchors", w_Joint_getAnchors },
-	{ "getReactionForce", w_Joint_getReactionForce },
-	{ "getReactionTorque", w_Joint_getReactionTorque },
-	{ "getCollideConnected", w_Joint_getCollideConnected },
-	{ "setUserData", w_Joint_setUserData },
-	{ "getUserData", w_Joint_getUserData },
-	{ "destroy", w_Joint_destroy },
-	{ "isDestroyed", w_Joint_isDestroyed },
 	{ 0, 0 }
 };
 
 extern "C" int luaopen_frictionjoint(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_FRICTION_JOINT_ID, functions);
+	return luax_register_type(L, PHYSICS_FRICTION_JOINT_ID, "FrictionJoint", w_Joint_functions, w_FrictionJoint_functions, nullptr);
 }
 
 } // box2d

+ 0 - 4
src/modules/physics/box2d/wrap_FrictionJoint.h

@@ -34,10 +34,6 @@ namespace box2d
 {
 
 FrictionJoint *luax_checkfrictionjoint(lua_State *L, int idx);
-int w_FrictionJoint_setMaxForce(lua_State *L);
-int w_FrictionJoint_getMaxForce(lua_State *L);
-int w_FrictionJoint_setMaxTorque(lua_State *L);
-int w_FrictionJoint_getMaxTorque(lua_State *L);
 extern "C" int luaopen_frictionjoint(lua_State *L);
 
 } // box2d

+ 2 - 13
src/modules/physics/box2d/wrap_GearJoint.cpp

@@ -67,28 +67,17 @@ int w_GearJoint_getJoints(lua_State *L)
 	return 2;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_GearJoint_functions[] =
 {
 	{ "setRatio", w_GearJoint_setRatio },
 	{ "getRatio", w_GearJoint_getRatio },
 	{ "getJoints", w_GearJoint_getJoints },
-	// From Joint.
-	{ "getType", w_Joint_getType },
-	{ "getBodies", w_Joint_getBodies },
-	{ "getAnchors", w_Joint_getAnchors },
-	{ "getReactionForce", w_Joint_getReactionForce },
-	{ "getReactionTorque", w_Joint_getReactionTorque },
-	{ "getCollideConnected", w_Joint_getCollideConnected },
-	{ "setUserData", w_Joint_setUserData },
-	{ "getUserData", w_Joint_getUserData },
-	{ "destroy", w_Joint_destroy },
-	{ "isDestroyed", w_Joint_isDestroyed },
 	{ 0, 0 }
 };
 
 extern "C" int luaopen_gearjoint(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_GEAR_JOINT_ID, functions);
+	return luax_register_type(L, PHYSICS_GEAR_JOINT_ID, "GearJoint", w_Joint_functions, w_GearJoint_functions, nullptr);
 }
 
 } // box2d

+ 0 - 3
src/modules/physics/box2d/wrap_GearJoint.h

@@ -34,9 +34,6 @@ namespace box2d
 {
 
 GearJoint *luax_checkgearjoint(lua_State *L, int idx);
-int w_GearJoint_setRatio(lua_State *L);
-int w_GearJoint_getRatio(lua_State *L);
-int w_GearJoint_getJoints(lua_State *L);
 extern "C" int luaopen_gearjoint(lua_State *L);
 
 } // box2d

+ 2 - 2
src/modules/physics/box2d/wrap_Joint.cpp

@@ -154,7 +154,7 @@ int w_Joint_isDestroyed(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+const luaL_Reg w_Joint_functions[] =
 {
 	{ "getType", w_Joint_getType },
 	{ "getBodies", w_Joint_getBodies },
@@ -171,7 +171,7 @@ static const luaL_Reg functions[] =
 
 extern "C" int luaopen_joint(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_JOINT_ID, functions);
+	return luax_register_type(L, PHYSICS_JOINT_ID, "Joint", w_Joint_functions, nullptr);
 }
 
 } // box2d

+ 2 - 10
src/modules/physics/box2d/wrap_Joint.h

@@ -34,18 +34,10 @@ namespace box2d
 
 void luax_pushjoint(lua_State *L, Joint *j);
 Joint *luax_checkjoint(lua_State *L, int idx);
-int w_Joint_getType(lua_State *L);
-int w_Joint_getBodies(lua_State *L);
-int w_Joint_getAnchors(lua_State *L);
-int w_Joint_getReactionForce(lua_State *L);
-int w_Joint_getReactionTorque(lua_State *L);
-int w_Joint_getCollideConnected(lua_State *L);
-int w_Joint_setUserData(lua_State *L);
-int w_Joint_getUserData(lua_State *L);
-int w_Joint_destroy(lua_State *L);
-int w_Joint_isDestroyed(lua_State *L);
 extern "C" int luaopen_joint(lua_State *L);
 
+extern const luaL_Reg w_Joint_functions[];
+
 } // box2d
 } // physics
 } // love

+ 2 - 13
src/modules/physics/box2d/wrap_MotorJoint.cpp

@@ -110,7 +110,7 @@ int w_MotorJoint_getCorrectionFactor(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_MotorJoint_functions[] =
 {
 	{ "setLinearOffset", w_MotorJoint_setLinearOffset },
 	{ "getLinearOffset", w_MotorJoint_getLinearOffset },
@@ -122,23 +122,12 @@ static const luaL_Reg functions[] =
 	{ "getMaxTorque", w_MotorJoint_getMaxTorque },
 	{ "setCorrectionFactor", w_MotorJoint_setCorrectionFactor },
 	{ "getCorrectionFactor", w_MotorJoint_getCorrectionFactor },
-	// From Joint.
-	{ "getType", w_Joint_getType },
-	{ "getBodies", w_Joint_getBodies },
-	{ "getAnchors", w_Joint_getAnchors },
-	{ "getReactionForce", w_Joint_getReactionForce },
-	{ "getReactionTorque", w_Joint_getReactionTorque },
-	{ "getCollideConnected", w_Joint_getCollideConnected },
-	{ "setUserData", w_Joint_setUserData },
-	{ "getUserData", w_Joint_getUserData },
-	{ "destroy", w_Joint_destroy },
-	{ "isDestroyed", w_Joint_isDestroyed },
 	{ 0, 0 }
 };
 
 extern "C" int luaopen_motorjoint(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_MOTOR_JOINT_ID, functions);
+	return luax_register_type(L, PHYSICS_MOTOR_JOINT_ID, "MotorJoint", w_Joint_functions, w_MotorJoint_functions, nullptr);
 }
 
 

+ 0 - 10
src/modules/physics/box2d/wrap_MotorJoint.h

@@ -34,16 +34,6 @@ namespace box2d
 {
 
 MotorJoint *luax_checkmotorjoint(lua_State *L, int idx);
-int w_MotorJoint_setLinearOffset(lua_State *L);
-int w_MotorJoint_getLinearOffset(lua_State *L);
-int w_MotorJoint_setAngularOffset(lua_State *L);
-int w_MotorJoint_getAngularOffset(lua_State *L);
-int w_MotorJoint_setMaxForce(lua_State *L);
-int w_MotorJoint_getMaxForce(lua_State *L);
-int w_MotorJoint_setMaxTorque(lua_State *L);
-int w_MotorJoint_getMaxTorque(lua_State *L);
-int w_MotorJoint_setCorrectionFactor(lua_State *L);
-int w_MotorJoint_getCorrectionFactor(lua_State *L);
 extern "C" int luaopen_motorjoint(lua_State *L);
 
 } // box2d

+ 2 - 13
src/modules/physics/box2d/wrap_MouseJoint.cpp

@@ -96,7 +96,7 @@ int w_MouseJoint_getDampingRatio(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_MouseJoint_functions[] =
 {
 	{ "setTarget", w_MouseJoint_setTarget },
 	{ "getTarget", w_MouseJoint_getTarget },
@@ -106,23 +106,12 @@ static const luaL_Reg functions[] =
 	{ "getFrequency", w_MouseJoint_getFrequency },
 	{ "setDampingRatio", w_MouseJoint_setDampingRatio },
 	{ "getDampingRatio", w_MouseJoint_getDampingRatio },
-	// From Joint.
-	{ "getType", w_Joint_getType },
-	{ "getBodies", w_Joint_getBodies },
-	{ "getAnchors", w_Joint_getAnchors },
-	{ "getReactionForce", w_Joint_getReactionForce },
-	{ "getReactionTorque", w_Joint_getReactionTorque },
-	{ "getCollideConnected", w_Joint_getCollideConnected },
-	{ "setUserData", w_Joint_setUserData },
-	{ "getUserData", w_Joint_getUserData },
-	{ "destroy", w_Joint_destroy },
-	{ "isDestroyed", w_Joint_isDestroyed },
 	{ 0, 0 }
 };
 
 extern "C" int luaopen_mousejoint(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_MOUSE_JOINT_ID, functions);
+	return luax_register_type(L, PHYSICS_MOUSE_JOINT_ID, "MouseJoint", w_Joint_functions, w_MouseJoint_functions, nullptr);
 }
 
 } // box2d

+ 0 - 8
src/modules/physics/box2d/wrap_MouseJoint.h

@@ -34,14 +34,6 @@ namespace box2d
 {
 
 MouseJoint *luax_checkmousejoint(lua_State *L, int idx);
-int w_MouseJoint_setTarget(lua_State *L);
-int w_MouseJoint_getTarget(lua_State *L);
-int w_MouseJoint_setMaxForce(lua_State *L);
-int w_MouseJoint_getMaxForce(lua_State *L);
-int w_MouseJoint_setFrequency(lua_State *L);
-int w_MouseJoint_getFrequency(lua_State *L);
-int w_MouseJoint_setDampingRatio(lua_State *L);
-int w_MouseJoint_getDampingRatio(lua_State *L);
 extern "C" int luaopen_mousejoint(lua_State *L);
 
 } // box2d

+ 0 - 22
src/modules/physics/box2d/wrap_Physics.h

@@ -32,28 +32,6 @@ namespace physics
 namespace box2d
 {
 
-int w_newWorld(lua_State *L);
-int w_newBody(lua_State *L);
-int w_newFixture(lua_State *L);
-int w_newCircleShape(lua_State *L);
-int w_newRectangleShape(lua_State *L);
-int w_newPolygonShape(lua_State *L);
-int w_newEdgeShape(lua_State *L);
-int w_newChainShape(lua_State *L);
-int w_newDistanceJoint(lua_State *L);
-int w_newMouseJoint(lua_State *L);
-int w_newRevoluteJoint(lua_State *L);
-int w_newPrismaticJoint(lua_State *L);
-int w_newPulleyJoint(lua_State *L);
-int w_newGearJoint(lua_State *L);
-int w_newFrictionJoint(lua_State *L);
-int w_newWeldJoint(lua_State *L);
-int w_newWheelJoint(lua_State *L);
-int w_newRopeJoint(lua_State *L);
-int w_newMotorJoint(lua_State *L);
-int w_getDistance(lua_State *L);
-int w_setMeter(lua_State *L);
-int w_getMeter(lua_State *L);
 extern "C" LOVE_EXPORT int luaopen_love_physics(lua_State *L);
 
 } // box2d

+ 2 - 10
src/modules/physics/box2d/wrap_PolygonShape.cpp

@@ -46,24 +46,16 @@ int w_PolygonShape_validate(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_PolygonShape_functions[] =
 {
 	{ "getPoints", w_PolygonShape_getPoints },
 	{ "validate", w_PolygonShape_validate },
-	// From Shape.
-	{ "getType", w_Shape_getType },
-	{ "getRadius", w_Shape_getRadius },
-	{ "getChildCount", w_Shape_getChildCount },
-	{ "testPoint", w_Shape_testPoint },
-	{ "rayCast", w_Shape_rayCast },
-	{ "computeAABB", w_Shape_computeAABB },
-	{ "computeMass", w_Shape_computeMass },
 	{ 0, 0 }
 };
 
 extern "C" int luaopen_polygonshape(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_POLYGON_SHAPE_ID, functions);
+	return luax_register_type(L, PHYSICS_POLYGON_SHAPE_ID, "PolygonShape", w_Shape_functions, w_PolygonShape_functions, nullptr);
 }
 
 } // box2d

+ 0 - 2
src/modules/physics/box2d/wrap_PolygonShape.h

@@ -34,8 +34,6 @@ namespace box2d
 {
 
 PolygonShape *luax_checkpolygonshape(lua_State *L, int idx);
-int w_PolygonShape_getPoints(lua_State *L);
-int w_PolygonShape_validate(lua_State *L);
 extern "C" int luaopen_polygonshape(lua_State *L);
 
 } // box2d

+ 2 - 13
src/modules/physics/box2d/wrap_PrismaticJoint.cpp

@@ -164,7 +164,7 @@ int w_PrismaticJoint_getLimits(lua_State *L)
 	return t->getLimits(L);
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_PrismaticJoint_functions[] =
 {
 	{ "getJointTranslation", w_PrismaticJoint_getJointTranslation },
 	{ "getJointSpeed", w_PrismaticJoint_getJointSpeed },
@@ -183,23 +183,12 @@ static const luaL_Reg functions[] =
 	{ "getLowerLimit", w_PrismaticJoint_getLowerLimit },
 	{ "getUpperLimit", w_PrismaticJoint_getUpperLimit },
 	{ "getLimits", w_PrismaticJoint_getLimits },
-	// From Joint.
-	{ "getType", w_Joint_getType },
-	{ "getBodies", w_Joint_getBodies },
-	{ "getAnchors", w_Joint_getAnchors },
-	{ "getReactionForce", w_Joint_getReactionForce },
-	{ "getReactionTorque", w_Joint_getReactionTorque },
-	{ "getCollideConnected", w_Joint_getCollideConnected },
-	{ "setUserData", w_Joint_setUserData },
-	{ "getUserData", w_Joint_getUserData },
-	{ "destroy", w_Joint_destroy },
-	{ "isDestroyed", w_Joint_isDestroyed },
 	{ 0, 0 }
 };
 
 extern "C" int luaopen_prismaticjoint(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_PRISMATIC_JOINT_ID, functions);
+	return luax_register_type(L, PHYSICS_PRISMATIC_JOINT_ID, "PrismaticJoint", w_Joint_functions, w_PrismaticJoint_functions, nullptr);
 }
 
 } // box2d

+ 0 - 17
src/modules/physics/box2d/wrap_PrismaticJoint.h

@@ -34,23 +34,6 @@ namespace box2d
 {
 
 PrismaticJoint *luax_checkprismaticjoint(lua_State *L, int idx);
-int w_PrismaticJoint_getJointTranslation(lua_State *L);
-int w_PrismaticJoint_getJointSpeed(lua_State *L);
-int w_PrismaticJoint_setMotorEnabled(lua_State *L);
-int w_PrismaticJoint_isMotorEnabled(lua_State *L);
-int w_PrismaticJoint_setMaxMotorForce(lua_State *L);
-int w_PrismaticJoint_setMotorSpeed(lua_State *L);
-int w_PrismaticJoint_getMotorSpeed(lua_State *L);
-int w_PrismaticJoint_getMotorForce(lua_State *L);
-int w_PrismaticJoint_getMaxMotorForce(lua_State *L);
-int w_PrismaticJoint_setLimitsEnabled(lua_State *L);
-int w_PrismaticJoint_hasLimitsEnabled(lua_State *L);
-int w_PrismaticJoint_setUpperLimit(lua_State *L);
-int w_PrismaticJoint_setLowerLimit(lua_State *L);
-int w_PrismaticJoint_setLimits(lua_State *L);
-int w_PrismaticJoint_getLowerLimit(lua_State *L);
-int w_PrismaticJoint_getUpperLimit(lua_State *L);
-int w_PrismaticJoint_getLimits(lua_State *L);
 extern "C" int luaopen_prismaticjoint(lua_State *L);
 
 } // box2d

+ 2 - 13
src/modules/physics/box2d/wrap_PulleyJoint.cpp

@@ -63,29 +63,18 @@ int w_PulleyJoint_getRatio(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_PulleyJoint_functions[] =
 {
 	{ "getGroundAnchors", w_PulleyJoint_getGroundAnchors },
 	{ "getLengthA", w_PulleyJoint_getLengthA },
 	{ "getLengthB", w_PulleyJoint_getLengthB },
 	{ "getRatio", w_PulleyJoint_getRatio },
-	// From Joint.
-	{ "getType", w_Joint_getType },
-	{ "getBodies", w_Joint_getBodies },
-	{ "getAnchors", w_Joint_getAnchors },
-	{ "getReactionForce", w_Joint_getReactionForce },
-	{ "getReactionTorque", w_Joint_getReactionTorque },
-	{ "getCollideConnected", w_Joint_getCollideConnected },
-	{ "setUserData", w_Joint_setUserData },
-	{ "getUserData", w_Joint_getUserData },
-	{ "destroy", w_Joint_destroy },
-	{ "isDestroyed", w_Joint_isDestroyed },
 	{ 0, 0 }
 };
 
 extern "C" int luaopen_pulleyjoint(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_PULLEY_JOINT_ID, functions);
+	return luax_register_type(L, PHYSICS_PULLEY_JOINT_ID, "PulleyJoint", w_Joint_functions, w_PulleyJoint_functions, nullptr);
 }
 
 } // box2d

+ 0 - 4
src/modules/physics/box2d/wrap_PulleyJoint.h

@@ -34,10 +34,6 @@ namespace box2d
 {
 
 PulleyJoint *luax_checkpulleyjoint(lua_State *L, int idx);
-int w_PulleyJoint_getGroundAnchors(lua_State *L);
-int w_PulleyJoint_getLengthA(lua_State *L);
-int w_PulleyJoint_getLengthB(lua_State *L);
-int w_PulleyJoint_getRatio(lua_State *L);
 extern "C" int luaopen_pulleyjoint(lua_State *L);
 
 } // box2d

+ 2 - 13
src/modules/physics/box2d/wrap_RevoluteJoint.cpp

@@ -164,7 +164,7 @@ int w_RevoluteJoint_getLimits(lua_State *L)
 	return t->getLimits(L);
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_RevoluteJoint_functions[] =
 {
 	{ "getJointAngle", w_RevoluteJoint_getJointAngle },
 	{ "getJointSpeed", w_RevoluteJoint_getJointSpeed },
@@ -183,23 +183,12 @@ static const luaL_Reg functions[] =
 	{ "getLowerLimit", w_RevoluteJoint_getLowerLimit },
 	{ "getUpperLimit", w_RevoluteJoint_getUpperLimit },
 	{ "getLimits", w_RevoluteJoint_getLimits },
-	// From Joint.
-	{ "getType", w_Joint_getType },
-	{ "getBodies", w_Joint_getBodies },
-	{ "getAnchors", w_Joint_getAnchors },
-	{ "getReactionForce", w_Joint_getReactionForce },
-	{ "getReactionTorque", w_Joint_getReactionTorque },
-	{ "getCollideConnected", w_Joint_getCollideConnected },
-	{ "setUserData", w_Joint_setUserData },
-	{ "getUserData", w_Joint_getUserData },
-	{ "destroy", w_Joint_destroy },
-	{ "isDestroyed", w_Joint_isDestroyed },
 	{ 0, 0 }
 };
 
 extern "C" int luaopen_revolutejoint(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_REVOLUTE_JOINT_ID, functions);
+	return luax_register_type(L, PHYSICS_REVOLUTE_JOINT_ID, "RevoluteJoint", w_Joint_functions, w_RevoluteJoint_functions, nullptr);
 }
 
 } // box2d

+ 0 - 17
src/modules/physics/box2d/wrap_RevoluteJoint.h

@@ -34,23 +34,6 @@ namespace box2d
 {
 
 RevoluteJoint *luax_checkrevolutejoint(lua_State *L, int idx);
-int w_RevoluteJoint_getJointAngle(lua_State *L);
-int w_RevoluteJoint_getJointSpeed(lua_State *L);
-int w_RevoluteJoint_setMotorEnabled(lua_State *L);
-int w_RevoluteJoint_isMotorEnabled(lua_State *L);
-int w_RevoluteJoint_setMaxMotorTorque(lua_State *L);
-int w_RevoluteJoint_setMotorSpeed(lua_State *L);
-int w_RevoluteJoint_getMotorSpeed(lua_State *L);
-int w_RevoluteJoint_getMotorTorque(lua_State *L);
-int w_RevoluteJoint_getMaxMotorTorque(lua_State *L);
-int w_RevoluteJoint_setLimitsEnabled(lua_State *L);
-int w_RevoluteJoint_hasLimitsEnabled(lua_State *L);
-int w_RevoluteJoint_setUpperLimit(lua_State *L);
-int w_RevoluteJoint_setLowerLimit(lua_State *L);
-int w_RevoluteJoint_setLimits(lua_State *L);
-int w_RevoluteJoint_getLowerLimit(lua_State *L);
-int w_RevoluteJoint_getUpperLimit(lua_State *L);
-int w_RevoluteJoint_getLimits(lua_State *L);
 extern "C" int luaopen_revolutejoint(lua_State *L);
 
 } // box2d

+ 2 - 13
src/modules/physics/box2d/wrap_RopeJoint.cpp

@@ -42,26 +42,15 @@ int w_RopeJoint_getMaxLength(lua_State *L)
 	return 1;
 }
 
-static const luaL_Reg functions[] =
+static const luaL_Reg w_RopeJoint_functions[] =
 {
 	{ "getMaxLength", w_RopeJoint_getMaxLength },
-	// From Joint.
-	{ "getType", w_Joint_getType },
-	{ "getBodies", w_Joint_getBodies },
-	{ "getAnchors", w_Joint_getAnchors },
-	{ "getReactionForce", w_Joint_getReactionForce },
-	{ "getReactionTorque", w_Joint_getReactionTorque },
-	{ "getCollideConnected", w_Joint_getCollideConnected },
-	{ "setUserData", w_Joint_setUserData },
-	{ "getUserData", w_Joint_getUserData },
-	{ "destroy", w_Joint_destroy },
-	{ "isDestroyed", w_Joint_isDestroyed },
 	{ 0, 0 }
 };
 
 extern "C" int luaopen_ropejoint(lua_State *L)
 {
-	return luax_register_type(L, PHYSICS_ROPE_JOINT_ID, functions);
+	return luax_register_type(L, PHYSICS_ROPE_JOINT_ID, "RopeJoint", w_Joint_functions, w_RopeJoint_functions, nullptr);
 }
 
 } // box2d

+ 0 - 1
src/modules/physics/box2d/wrap_RopeJoint.h

@@ -34,7 +34,6 @@ namespace box2d
 {
 
 RopeJoint *luax_checkropejoint(lua_State *L, int idx);
-int w_RopeJoint_getMaxLength(lua_State *L);
 extern "C" int luaopen_ropejoint(lua_State *L);
 
 } // box2d

Some files were not shown because too many files changed in this diff