mirror of
https://github.com/love2d/love.git
synced 2026-08-15 07:41:11 +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},
|
||||
|
||||
Reference in New Issue
Block a user