- [NEW] beat() function

This commit is contained in:
2023-01-30 15:51:45 +01:00
parent c335edee57
commit 0e1e74a000
3 changed files with 21 additions and 0 deletions

View File

@@ -507,6 +507,12 @@ extern "C" {
return 1;
}
static int cpp_beat(lua_State *L) {
int16_t beats = luaL_optnumber(L, 1, -1);
lua_pushboolean(L, beat(beats));
return 1;
}
static int cpp_abs(lua_State *L) {
float x = luaL_checknumber(L, 1);
lua_pushnumber(L, abs(x));
@@ -842,6 +848,7 @@ void push_lua_funcs() {
lua_pushcfunction(L,cpp_mbtnp); lua_setglobal(L, "mbtnp");
lua_pushcfunction(L,cpp_time); lua_setglobal(L, "time");
lua_pushcfunction(L,cpp_beat); lua_setglobal(L, "beat");
lua_pushcfunction(L,cpp_abs); lua_setglobal(L, "abs");
lua_pushcfunction(L,cpp_ceil); lua_setglobal(L, "ceil");
lua_pushcfunction(L,cpp_flr); lua_setglobal(L, "flr");