- [NEW] exit()

- [NEW] anykey()
- [NEW] ismusicplaying()
This commit is contained in:
2022-10-13 18:40:41 +02:00
parent d4ad849add
commit f1c87e4d25
3 changed files with 39 additions and 3 deletions

19
lua.cpp
View File

@@ -450,6 +450,11 @@ extern "C" {
return 1;
}
static int cpp_anykey(lua_State *L) {
lua_pushboolean(L, anykey());
return 1;
}
static int cpp_mousex(lua_State *L) {
lua_pushinteger(L, mousex());
return 1;
@@ -666,6 +671,16 @@ extern "C" {
return 0;
}
static int cpp_ismusicplaying(lua_State *L) {
lua_pushboolean(L,ismusicplaying());
return 1;
}
static int cpp_exit(lua_State *L) {
exit();
return 0;
}
}
lua_State *L;
@@ -722,6 +737,7 @@ void push_lua_funcs() {
lua_pushcfunction(L,cpp_map); lua_setglobal(L, "map");
lua_pushcfunction(L,cpp_btn); lua_setglobal(L, "btn");
lua_pushcfunction(L,cpp_btnp); lua_setglobal(L, "btnp");
lua_pushcfunction(L,cpp_anykey); lua_setglobal(L, "anykey");
lua_pushcfunction(L,cpp_mousex); lua_setglobal(L, "mousex");
lua_pushcfunction(L,cpp_mousey); lua_setglobal(L, "mousey");
lua_pushcfunction(L,cpp_mwheel); lua_setglobal(L, "mwheel");
@@ -765,6 +781,9 @@ void push_lua_funcs() {
lua_pushcfunction(L,cpp_pausemusic); lua_setglobal(L, "pausemusic");
lua_pushcfunction(L,cpp_resumemusic); lua_setglobal(L, "resumemusic");
lua_pushcfunction(L,cpp_stopmusic); lua_setglobal(L, "stopmusic");
lua_pushcfunction(L,cpp_ismusicplaying); lua_setglobal(L, "ismusicplaying");
lua_pushcfunction(L,cpp_exit); lua_setglobal(L, "exit");
lua_pushinteger(L, 0); lua_setglobal(L, "KEY_UNKNOWN");
lua_pushinteger(L, 4); lua_setglobal(L, "KEY_A");