mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Automatically deduce the type in luax_checktype, luax_getmodule, luax_optmodule and luax_totype
--HG-- branch : dynamiccore2
This commit is contained in:
@@ -63,9 +63,9 @@ int w_newSource(lua_State *L)
|
||||
|
||||
luax_catchexcept(L, [&]() {
|
||||
if (luax_istype(L, 1, love::sound::SoundData::type))
|
||||
t = instance()->newSource(luax_totype<love::sound::SoundData>(L, 1, love::sound::SoundData::type));
|
||||
t = instance()->newSource(luax_totype<love::sound::SoundData>(L, 1));
|
||||
else if (luax_istype(L, 1, love::sound::Decoder::type))
|
||||
t = instance()->newSource(luax_totype<love::sound::Decoder>(L, 1, love::sound::Decoder::type));
|
||||
t = instance()->newSource(luax_totype<love::sound::Decoder>(L, 1));
|
||||
});
|
||||
|
||||
if (t != nullptr)
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace audio
|
||||
|
||||
Source *luax_checksource(lua_State *L, int idx)
|
||||
{
|
||||
return luax_checktype<Source>(L, idx, love::audio::Source::type);
|
||||
return luax_checktype<Source>(L, idx);
|
||||
}
|
||||
|
||||
int w_Source_clone(lua_State *L)
|
||||
@@ -344,7 +344,7 @@ int w_Source_queue(lua_State *L)
|
||||
|
||||
if (luax_istype(L, 2, love::sound::SoundData::type))
|
||||
{
|
||||
auto s = luax_totype<love::sound::SoundData>(L, 2, love::sound::SoundData::type);
|
||||
auto s = luax_totype<love::sound::SoundData>(L, 2);
|
||||
|
||||
int offset = 0;
|
||||
size_t length = s->getSize();
|
||||
|
||||
Reference in New Issue
Block a user