me.fier.engine/modules/engine/lua_manual.c

25 lines
755 B
C
Raw Normal View History

2023-05-15 13:28:58 +00:00
int engine_luaf_lua_event_get_data(lua_State *L) {
struct ENGINE_EVENT * event = lua_touserdata(L,1);
char type = event->type;
if (type == ENGINE_EVENT_TYPE_UNKNOWN) { goto simple; }
if (type == ENGINE_EVENT_TYPE_NONE) { goto simple; }
if (type == ENGINE_EVENT_TYPE_EXIT) { goto simple; }
if (type == ENGINE_EVENT_TYPE_INPUT_KB) {
struct ENGINE_EVENT_INPUT_KB * data = event->data;
lua_pushinteger(L,type);
lua_pushinteger(L,data->key);
lua_pushinteger(L,data->pressed);
return 3;
}
2023-05-15 09:08:45 +00:00
2023-05-15 13:28:58 +00:00
type = ENGINE_EVENT_TYPE_UNKNOWN;
simple:
lua_pushinteger(L,type);
return 1;
}
void engine_lua_init_manual() {
lua_pushcfunction(engine_lua_state,engine_luaf_lua_event_get_data);
lua_setglobal (engine_lua_state,"engine_lua_event_get_data");
2023-05-15 09:08:45 +00:00
}