mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
EncodedImageData was implemented really stupidly. Now it's less stupid.
This commit is contained in:
+16
-15
@@ -205,21 +205,21 @@ namespace love
|
||||
|
||||
int luax_register_searcher(lua_State * L, lua_CFunction f)
|
||||
{
|
||||
// Add the package loader to the package.loaders table.
|
||||
lua_getglobal(L, "package");
|
||||
|
||||
if(lua_isnil(L, -1))
|
||||
return luaL_error(L, "Can't register searcher: package table does not exist.");
|
||||
|
||||
lua_getfield(L, -1, "loaders");
|
||||
|
||||
if(lua_isnil(L, -1))
|
||||
return luaL_error(L, "Can't register searcher: package.loaders table does not exist.");
|
||||
|
||||
int len = lua_objlen(L, -1);
|
||||
lua_pushinteger(L, len+1);
|
||||
lua_pushcfunction(L, f);
|
||||
lua_settable(L, -3);
|
||||
// Add the package loader to the package.loaders table.
|
||||
lua_getglobal(L, "package");
|
||||
|
||||
if(lua_isnil(L, -1))
|
||||
return luaL_error(L, "Can't register searcher: package table does not exist.");
|
||||
|
||||
lua_getfield(L, -1, "loaders");
|
||||
|
||||
if(lua_isnil(L, -1))
|
||||
return luaL_error(L, "Can't register searcher: package.loaders table does not exist.");
|
||||
|
||||
int len = lua_objlen(L, -1);
|
||||
lua_pushinteger(L, len+1);
|
||||
lua_pushcfunction(L, f);
|
||||
lua_settable(L, -3);
|
||||
lua_pop(L, 2);
|
||||
return 0;
|
||||
}
|
||||
@@ -362,6 +362,7 @@ namespace love
|
||||
|
||||
// Image
|
||||
{"ImageData", IMAGE_IMAGE_DATA_ID},
|
||||
{"EncodedImageData", IMAGE_ENCODED_IMAGE_DATA_ID},
|
||||
|
||||
// Audio
|
||||
{"Source", AUDIO_SOURCE_ID},
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace love
|
||||
|
||||
// Image
|
||||
IMAGE_IMAGE_DATA_ID,
|
||||
IMAGE_ENCODED_IMAGE_DATA_ID,
|
||||
|
||||
// Audio
|
||||
AUDIO_SOURCE_ID,
|
||||
@@ -116,6 +117,7 @@ namespace love
|
||||
|
||||
// Image.
|
||||
const bits IMAGE_IMAGE_DATA_T = (bits(1) << IMAGE_IMAGE_DATA_ID) | DATA_T;
|
||||
const bits IMAGE_ENCODED_IMAGE_DATA_T = (bits(1) << IMAGE_ENCODED_IMAGE_DATA_ID) | DATA_T;
|
||||
|
||||
// Audio.
|
||||
const bits AUDIO_SOURCE_T = (bits(1) << AUDIO_SOURCE_ID) | OBJECT_T;
|
||||
|
||||
Reference in New Issue
Block a user