LuaBox
Loading...
Searching...
No Matches
ButtonWaitRelease.h
Go to the documentation of this file.
1#pragma once
2
3#include "lua_include.h"
4#include "global.h"
5#include "buttons.h"
6
12
13int ButtonWaitRelease(lua_State* L_)
14{
15 const char* b = luaL_checkstring(L_, 1);
16
17 int p = -1;
18 if (strcmp(b, "UP") == 0)
19 {
20 p = UP;
21 }
22 else if (strcmp(b, "DOWN") == 0)
23 {
24 p = DOWN;
25 }
26 else if (strcmp(b, "LEFT") == 0)
27 {
28 p = LEFT;
29 }
30 else if (strcmp(b, "RIGHT") == 0)
31 {
32 p = RIGHT;
33 }
34 else if (strcmp(b, "SELECT") == 0)
35 {
36 p = SELECT;
37 }
38 else if (strcmp(b, "GET") == 0)
39 {
40 p = GET;
41 }
42 else if (strcmp(b, "SET") == 0)
43 {
44 p = SET;
45 }
46
47 while (buttons_read(p))
48 {
49 vTaskDelay(pdMS_TO_TICKS(10));
50 }
51
52 return 0;
53}
int ButtonWaitRelease(lua_State *L_)
Halt until the specified button is released.
Definition ButtonWaitRelease.h:13