LuaBox
Loading...
Searching...
No Matches
ButtonDown.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 ButtonDown(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 lua_pushboolean(L_, buttons_read(p));
48
49 return 1;
50}
int ButtonDown(lua_State *L_)
Check if a button is held down.
Definition ButtonDown.h:13