VERSIÓ 1.3.7

- [NEW] music.enable() i sound.enable()
This commit is contained in:
2025-10-30 16:27:40 +01:00
parent 4172c6af3d
commit 62ac5ae92d
7 changed files with 82 additions and 1 deletions

22
lua.cpp
View File

@@ -584,6 +584,16 @@ extern "C" {
}
}
static int cpp_music_enable(lua_State *L) {
if (lua_gettop(L) == 0) {
lua_pushboolean(L, ismusicenabled());
return 1;
} else {
enablemusic(lua_toboolean(L, 1));
return 0;
}
}
// sound
// ===============================================
@@ -613,6 +623,16 @@ extern "C" {
return 0;
}
static int cpp_sound_enable(lua_State *L) {
if (lua_gettop(L) == 0) {
lua_pushboolean(L, issoundenabled());
return 1;
} else {
enablesound(lua_toboolean(L, 1));
return 0;
}
}
// sys
// ===============================================
@@ -913,6 +933,7 @@ void push_lua_funcs() {
lua_pushcfunction(L,cpp_music_resume); lua_setfield(L, -2, "resume");
lua_pushcfunction(L,cpp_music_stop); lua_setfield(L, -2, "stop");
lua_pushcfunction(L,cpp_music_pos); lua_setfield(L, -2, "pos");
lua_pushcfunction(L,cpp_music_enable); lua_setfield(L, -2, "enabled");
lua_setglobal(L, "music");
lua_newtable(L);
@@ -920,6 +941,7 @@ void push_lua_funcs() {
lua_pushcfunction(L,cpp_sound_free); lua_setfield(L, -2, "free");
lua_pushcfunction(L,cpp_sound_play); lua_setfield(L, -2, "play");
lua_pushcfunction(L,cpp_sound_stop); lua_setfield(L, -2, "stop");
lua_pushcfunction(L,cpp_sound_enable); lua_setfield(L, -2, "enabled");
lua_setglobal(L, "sound");
lua_newtable(L);