mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Automatically deduce the type in luax_pushtype, if possible
--HG-- branch : dynamiccore2
This commit is contained in:
@@ -70,7 +70,7 @@ int w_newSource(lua_State *L)
|
||||
|
||||
if (t != nullptr)
|
||||
{
|
||||
luax_pushtype(L, love::audio::Source::type, t);
|
||||
luax_pushtype(L, t);
|
||||
t->release();
|
||||
return 1;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ int w_newQueueableSource(lua_State *L)
|
||||
|
||||
if (t != nullptr)
|
||||
{
|
||||
luax_pushtype(L, love::audio::Source::type, t);
|
||||
luax_pushtype(L, t);
|
||||
t->release();
|
||||
return 1;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ int w_pause(lua_State *L)
|
||||
lua_createtable(L, (int) sources.size(), 0);
|
||||
for (int i = 0; i < (int) sources.size(); i++)
|
||||
{
|
||||
luax_pushtype(L, love::audio::Source::type, sources[i]);
|
||||
luax_pushtype(L, sources[i]);
|
||||
lua_rawseti(L, -2, i+1);
|
||||
}
|
||||
return 1;
|
||||
@@ -270,7 +270,7 @@ int w_getRecordedData(lua_State *L)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
{
|
||||
luax_pushtype(L, love::sound::SoundData::type, sd);
|
||||
luax_pushtype(L, sd);
|
||||
sd->release();
|
||||
}
|
||||
return 1;
|
||||
@@ -285,7 +285,7 @@ int w_stopRecording(lua_State *L)
|
||||
lua_pushnil(L);
|
||||
else
|
||||
{
|
||||
luax_pushtype(L, love::sound::SoundData::type, sd);
|
||||
luax_pushtype(L, sd);
|
||||
sd->release();
|
||||
}
|
||||
return 1;
|
||||
|
||||
@@ -38,7 +38,7 @@ int w_Source_clone(lua_State *L)
|
||||
Source *t = luax_checksource(L, 1);
|
||||
Source *clone = nullptr;
|
||||
luax_catchexcept(L, [&](){ clone = t->clone(); });
|
||||
luax_pushtype(L, love::audio::Source::type, clone);
|
||||
luax_pushtype(L, clone);
|
||||
clone->release();
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user