~npisanti/raylyeh

76df779338fe34bab758f532e4cf7b1b42d3749d — Nicola Pisanti 2 months ago c37e991 master
clock namespace set and get
1 files changed, 9 insertions(+), 2 deletions(-)

M src/lfo.c
M src/lfo.c => src/lfo.c +9 -2
@@ 59,7 59,7 @@ double rl_clock(void)

// ------------------------------------------------------------------------------

static int clock_now(lua_State * L)
static int clock_get(lua_State * L)
{
	lua_pushnumber(L, rl__clock);
	return 1;


@@ 71,6 71,12 @@ static int clock_warp(lua_State * L)
	return 0;
}

static int clock_set(lua_State * L)
{
	rl__clock = (float)luaL_checknumber(L, 1);
	return 0;
}

// ------------------------------------------------------------------------------

static int lfo_triangle(lua_State * L)


@@ 262,7 268,8 @@ static const luaL_Reg noise_namespace[] = {
    {NULL, NULL}};

static const luaL_Reg clock_namespace[] = {
    {"now", clock_now},
    {"get", clock_get},
    {"set", clock_set},
    {"warp", clock_warp},
    {NULL, NULL}};