mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Replaced most cases of type bits and type name strings in love's Lua wrapper code with type id's.
--HG-- branch : minor
This commit is contained in:
@@ -28,7 +28,7 @@ namespace image
|
||||
|
||||
CompressedData *luax_checkcompresseddata(lua_State *L, int idx)
|
||||
{
|
||||
return luax_checktype<CompressedData>(L, idx, "CompressedData", IMAGE_COMPRESSED_DATA_T);
|
||||
return luax_checktype<CompressedData>(L, idx, IMAGE_COMPRESSED_DATA_ID);
|
||||
}
|
||||
|
||||
int w_CompressedData_getWidth(lua_State *L)
|
||||
@@ -111,7 +111,7 @@ static const luaL_Reg functions[] =
|
||||
|
||||
extern "C" int luaopen_compresseddata(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, "CompressedData", functions);
|
||||
return luax_register_type(L, IMAGE_COMPRESSED_DATA_ID, functions);
|
||||
}
|
||||
|
||||
} // image
|
||||
|
||||
@@ -47,7 +47,7 @@ int w_newImageData(lua_State *L)
|
||||
ImageData *t = nullptr;
|
||||
luax_catchexcept(L, [&](){ t = instance()->newImageData(w, h); });
|
||||
|
||||
luax_pushtype(L, "ImageData", IMAGE_IMAGE_DATA_T, t);
|
||||
luax_pushtype(L, IMAGE_IMAGE_DATA_ID, t);
|
||||
t->release();
|
||||
return 1;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ int w_newImageData(lua_State *L)
|
||||
[&]() { data->release(); }
|
||||
);
|
||||
|
||||
luax_pushtype(L, "ImageData", IMAGE_IMAGE_DATA_T, t);
|
||||
luax_pushtype(L, IMAGE_IMAGE_DATA_ID, t);
|
||||
t->release();
|
||||
return 1;
|
||||
}
|
||||
@@ -76,7 +76,7 @@ int w_newCompressedData(lua_State *L)
|
||||
[&]() { data->release(); }
|
||||
);
|
||||
|
||||
luax_pushtype(L, "CompressedData", IMAGE_COMPRESSED_DATA_T, t);
|
||||
luax_pushtype(L, IMAGE_COMPRESSED_DATA_ID, t);
|
||||
t->release();
|
||||
return 1;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ extern "C" int luaopen_love_image(lua_State *L)
|
||||
WrappedModule w;
|
||||
w.module = instance;
|
||||
w.name = "image";
|
||||
w.flags = MODULE_IMAGE_T;
|
||||
w.type = MODULE_IMAGE_ID;
|
||||
w.functions = functions;
|
||||
w.types = types;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace image
|
||||
|
||||
ImageData *luax_checkimagedata(lua_State *L, int idx)
|
||||
{
|
||||
return luax_checktype<ImageData>(L, idx, "ImageData", IMAGE_IMAGE_DATA_T);
|
||||
return luax_checktype<ImageData>(L, idx, IMAGE_IMAGE_DATA_ID);
|
||||
}
|
||||
|
||||
int w_ImageData_getWidth(lua_State *L)
|
||||
@@ -245,7 +245,7 @@ int w_ImageData_encode(lua_State *L)
|
||||
|
||||
if (lua_isstring(L, 2))
|
||||
luax_convobj(L, 2, "filesystem", "newFile");
|
||||
love::filesystem::File *file = luax_checktype<love::filesystem::File>(L, 2, "File", FILESYSTEM_FILE_T);
|
||||
love::filesystem::File *file = luax_checktype<love::filesystem::File>(L, 2, FILESYSTEM_FILE_ID);
|
||||
|
||||
if (lua_isnoneornil(L, 3))
|
||||
{
|
||||
@@ -285,7 +285,7 @@ static const luaL_Reg functions[] =
|
||||
|
||||
extern "C" int luaopen_imagedata(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, "ImageData", functions);
|
||||
return luax_register_type(L, IMAGE_IMAGE_DATA_ID, functions);
|
||||
}
|
||||
|
||||
} // image
|
||||
|
||||
Reference in New Issue
Block a user