mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 22:11:51 +00:00
fix audio.play type checks
This commit is contained in:
parent
736cdb0980
commit
6daaa4895b
1 changed files with 5 additions and 5 deletions
|
|
@ -8,7 +8,7 @@ inline const char* DEFAULT_CHANNEL = "regular";
|
||||||
|
|
||||||
inline int extract_channel_index(lua::State* L, int idx) {
|
inline int extract_channel_index(lua::State* L, int idx) {
|
||||||
const char* channel = DEFAULT_CHANNEL;
|
const char* channel = DEFAULT_CHANNEL;
|
||||||
if (!lua::isnoneornil(L, idx)) {
|
if (lua::isstring(L, idx)) {
|
||||||
channel = lua::tostring(L, idx);
|
channel = lua::tostring(L, idx);
|
||||||
}
|
}
|
||||||
int index = audio::get_channel_index(channel);
|
int index = audio::get_channel_index(channel);
|
||||||
|
|
@ -121,7 +121,7 @@ static int l_audio_play_stream(lua::State* L) {
|
||||||
return lua::pushinteger(
|
return lua::pushinteger(
|
||||||
L,
|
L,
|
||||||
static_cast<lua::Integer>(play_stream(
|
static_cast<lua::Integer>(play_stream(
|
||||||
lua::tostring(L, 1),
|
lua::require_string(L, 1),
|
||||||
false,
|
false,
|
||||||
lua::tonumber(L, 2),
|
lua::tonumber(L, 2),
|
||||||
lua::tonumber(L, 3),
|
lua::tonumber(L, 3),
|
||||||
|
|
@ -144,7 +144,7 @@ static int l_audio_play_stream_2d(lua::State* L) {
|
||||||
return lua::pushinteger(
|
return lua::pushinteger(
|
||||||
L,
|
L,
|
||||||
static_cast<lua::Integer>(play_stream(
|
static_cast<lua::Integer>(play_stream(
|
||||||
lua::tostring(L, 1),
|
lua::require_string(L, 1),
|
||||||
true,
|
true,
|
||||||
0.0,
|
0.0,
|
||||||
0.0,
|
0.0,
|
||||||
|
|
@ -170,7 +170,7 @@ static int l_audio_play_sound(lua::State* L) {
|
||||||
return lua::pushinteger(
|
return lua::pushinteger(
|
||||||
L,
|
L,
|
||||||
static_cast<lua::Integer>(play_sound(
|
static_cast<lua::Integer>(play_sound(
|
||||||
lua::tostring(L, 1),
|
lua::require_string(L, 1),
|
||||||
false,
|
false,
|
||||||
lua::tonumber(L, 2),
|
lua::tonumber(L, 2),
|
||||||
lua::tonumber(L, 3),
|
lua::tonumber(L, 3),
|
||||||
|
|
@ -193,7 +193,7 @@ static int l_audio_play_sound_2d(lua::State* L) {
|
||||||
return lua::pushinteger(
|
return lua::pushinteger(
|
||||||
L,
|
L,
|
||||||
static_cast<lua::Integer>(play_sound(
|
static_cast<lua::Integer>(play_sound(
|
||||||
lua::tostring(L, 1),
|
lua::require_string(L, 1),
|
||||||
true,
|
true,
|
||||||
0.0,
|
0.0,
|
||||||
0.0,
|
0.0,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue