From c407e5b904a69f3849831ba88074440707f0c6cd Mon Sep 17 00:00:00 2001
From: sanine-a <sanine.not@pm.me>
Date: Wed, 21 Oct 2020 19:53:22 -0500
Subject: add honey_lua.h and honey_lua.h

---
 .gitignore          |   1 +
 CMakeLists.txt      |   1 +
 src/honey.c         |   4 +-
 src/input/.#input.h |   1 -
 src/input/input.c   | 489 ++++++++++++++--------------------------------------
 src/input/input.h   |   1 +
 src/lua/honey_lua.c |  40 +++++
 src/lua/honey_lua.h |  46 +++++
 8 files changed, 216 insertions(+), 367 deletions(-)
 delete mode 120000 src/input/.#input.h
 create mode 100644 src/lua/honey_lua.c
 create mode 100644 src/lua/honey_lua.h

diff --git a/.gitignore b/.gitignore
index 00a4ba3..6fe60c7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ include/*
 build/*
 *~
 *#
+*.#*
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 21f5467..d2e0ab1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,7 @@ set(SOURCE_FILES
   src/error/error.c
   src/honey.c
   src/input/input.c
+  src/lua/honey_lua.c
   src/light/light.c
   src/mesh/mesh.c
   src/model/model.c
diff --git a/src/honey.c b/src/honey.c
index 4d31090..71d07b1 100644
--- a/src/honey.c
+++ b/src/honey.c
@@ -65,5 +65,5 @@ void honey_run(honey_window window) {
     honey_draw_callback();
   }
 }
-    
-  
+
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
diff --git a/src/input/.#input.h b/src/input/.#input.h
deleted file mode 120000
index 4ad0568..0000000
--- a/src/input/.#input.h
+++ /dev/null
@@ -1 +0,0 @@
-kate@ophelia.6336:1602737412
\ No newline at end of file
diff --git a/src/input/input.c b/src/input/input.c
index 31375cc..66ee093 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -13,370 +13,131 @@ void honey_setup_keyboard()
 
 void honey_setup_input(lua_State* L)
 {
-    lua_createtable(L, 0, 121);
-
-    lua_pushinteger(L, HONEY_KEY_UNKNOWN);
-    lua_setfield(L, -2, "honey_key_unknown");
-    
-    lua_pushinteger(L, HONEY_KEY_SPACE);
-    lua_setfield(L, -2, "honey_key_space");
-    
-    lua_pushinteger(L, HONEY_KEY_APOSTROPHE);
-    lua_setfield(L, -2, "honey_key_apostrophe");
-    
-    lua_pushinteger(L, HONEY_KEY_COMMA);
-    lua_setfield(L, -2, "honey_key_comma");
-    
-    lua_pushinteger(L, HONEY_KEY_MINUS);
-    lua_setfield(L, -2, "honey_key_minus");
-    
-    lua_pushinteger(L, HONEY_KEY_PERIOD);
-    lua_setfield(L, -2, "honey_key_period");
-    
-    lua_pushinteger(L, HONEY_KEY_SLASH);
-    lua_setfield(L, -2, "honey_key_slash");
-    
-    lua_pushinteger(L, HONEY_KEY_0);
-    lua_setfield(L, -2, "honey_key_0");
-    
-    lua_pushinteger(L, HONEY_KEY_1);
-    lua_setfield(L, -2, "honey_key_1");
-    
-    lua_pushinteger(L, HONEY_KEY_2);
-    lua_setfield(L, -2, "honey_key_2");
-    
-    lua_pushinteger(L, HONEY_KEY_3);
-    lua_setfield(L, -2, "honey_key_3");
-    
-    lua_pushinteger(L, HONEY_KEY_4);
-    lua_setfield(L, -2, "honey_key_4");
-    
-    lua_pushinteger(L, HONEY_KEY_5);
-    lua_setfield(L, -2, "honey_key_5");
-    
-    lua_pushinteger(L, HONEY_KEY_6);
-    lua_setfield(L, -2, "honey_key_6");
-    
-    lua_pushinteger(L, HONEY_KEY_7);
-    lua_setfield(L, -2, "honey_key_7");
-    
-    lua_pushinteger(L, HONEY_KEY_8);
-    lua_setfield(L, -2, "honey_key_8");
-    
-    lua_pushinteger(L, HONEY_KEY_9);
-    lua_setfield(L, -2, "honey_key_9");
-    
-    lua_pushinteger(L, HONEY_KEY_SEMICOLON);
-    lua_setfield(L, -2, "honey_key_semicolon");
-    
-    lua_pushinteger(L, HONEY_KEY_EQUAL);
-    lua_setfield(L, -2, "honey_key_equal");
-    
-    lua_pushinteger(L, HONEY_KEY_A);
-    lua_setfield(L, -2, "honey_key_a");
-    
-    lua_pushinteger(L, HONEY_KEY_B);
-    lua_setfield(L, -2, "honey_key_b");
-    
-    lua_pushinteger(L, HONEY_KEY_C);
-    lua_setfield(L, -2, "honey_key_c");
-    
-    lua_pushinteger(L, HONEY_KEY_D);
-    lua_setfield(L, -2, "honey_key_d");
-    
-    lua_pushinteger(L, HONEY_KEY_E);
-    lua_setfield(L, -2, "honey_key_e");
-    
-    lua_pushinteger(L, HONEY_KEY_F);
-    lua_setfield(L, -2, "honey_key_f");
-    
-    lua_pushinteger(L, HONEY_KEY_G);
-    lua_setfield(L, -2, "honey_key_g");
-    
-    lua_pushinteger(L, HONEY_KEY_H);
-    lua_setfield(L, -2, "honey_key_h");
-    
-    lua_pushinteger(L, HONEY_KEY_I);
-    lua_setfield(L, -2, "honey_key_i");
-    
-    lua_pushinteger(L, HONEY_KEY_J);
-    lua_setfield(L, -2, "honey_key_j");
-    
-    lua_pushinteger(L, HONEY_KEY_K);
-    lua_setfield(L, -2, "honey_key_k");
-    
-    lua_pushinteger(L, HONEY_KEY_L);
-    lua_setfield(L, -2, "honey_key_l");
-    
-    lua_pushinteger(L, HONEY_KEY_M);
-    lua_setfield(L, -2, "honey_key_m");
-    
-    lua_pushinteger(L, HONEY_KEY_N);
-    lua_setfield(L, -2, "honey_key_n");
-    
-    lua_pushinteger(L, HONEY_KEY_O);
-    lua_setfield(L, -2, "honey_key_o");
-    
-    lua_pushinteger(L, HONEY_KEY_P);
-    lua_setfield(L, -2, "honey_key_p");
-    
-    lua_pushinteger(L, HONEY_KEY_Q);
-    lua_setfield(L, -2, "honey_key_q");
-    
-    lua_pushinteger(L, HONEY_KEY_R);
-    lua_setfield(L, -2, "honey_key_r");
-    
-    lua_pushinteger(L, HONEY_KEY_S);
-    lua_setfield(L, -2, "honey_key_s");
-    
-    lua_pushinteger(L, HONEY_KEY_T);
-    lua_setfield(L, -2, "honey_key_t");
-    
-    lua_pushinteger(L, HONEY_KEY_U);
-    lua_setfield(L, -2, "honey_key_u");
-    
-    lua_pushinteger(L, HONEY_KEY_V);
-    lua_setfield(L, -2, "honey_key_v");
-    
-    lua_pushinteger(L, HONEY_KEY_W);
-    lua_setfield(L, -2, "honey_key_w");
-    
-    lua_pushinteger(L, HONEY_KEY_X);
-    lua_setfield(L, -2, "honey_key_x");
-    
-    lua_pushinteger(L, HONEY_KEY_Y);
-    lua_setfield(L, -2, "honey_key_y");
-    
-    lua_pushinteger(L, HONEY_KEY_Z);
-    lua_setfield(L, -2, "honey_key_z");
-    
-    lua_pushinteger(L, HONEY_KEY_LEFT_BRACKET);
-    lua_setfield(L, -2, "honey_key_left_bracket");
-    
-    lua_pushinteger(L, HONEY_KEY_BACKSLASH);
-    lua_setfield(L, -2, "honey_key_backslash");
-    
-    lua_pushinteger(L, HONEY_KEY_RIGHT_BRACKET);
-    lua_setfield(L, -2, "honey_key_right_bracket");
-    
-    lua_pushinteger(L, HONEY_KEY_GRAVE_ACCENT);
-    lua_setfield(L, -2, "honey_key_grave_accent");
-    
-    lua_pushinteger(L, HONEY_KEY_WORLD_1);
-    lua_setfield(L, -2, "honey_key_world_1");
-    
-    lua_pushinteger(L, HONEY_KEY_WORLD_2);
-    lua_setfield(L, -2, "honey_key_world_2");
-    
-    lua_pushinteger(L, HONEY_KEY_ESCAPE);
-    lua_setfield(L, -2, "honey_key_escape");
-    
-    lua_pushinteger(L, HONEY_KEY_ENTER);
-    lua_setfield(L, -2, "honey_key_enter");
-    
-    lua_pushinteger(L, HONEY_KEY_TAB);
-    lua_setfield(L, -2, "honey_key_tab");
-    
-    lua_pushinteger(L, HONEY_KEY_BACKSPACE);
-    lua_setfield(L, -2, "honey_key_backspace");
-    
-    lua_pushinteger(L, HONEY_KEY_INSERT);
-    lua_setfield(L, -2, "honey_key_insert");
-    
-    lua_pushinteger(L, HONEY_KEY_DELETE);
-    lua_setfield(L, -2, "honey_key_delete");
-    
-    lua_pushinteger(L, HONEY_KEY_RIGHT);
-    lua_setfield(L, -2, "honey_key_right");
-    
-    lua_pushinteger(L, HONEY_KEY_LEFT);
-    lua_setfield(L, -2, "honey_key_left");
-    
-    lua_pushinteger(L, HONEY_KEY_DOWN);
-    lua_setfield(L, -2, "honey_key_down");
-    
-    lua_pushinteger(L, HONEY_KEY_UP);
-    lua_setfield(L, -2, "honey_key_up");
-    
-    lua_pushinteger(L, HONEY_KEY_PAGE_UP);
-    lua_setfield(L, -2, "honey_key_page_up");
-    
-    lua_pushinteger(L, HONEY_KEY_PAGE_DOWN);
-    lua_setfield(L, -2, "honey_key_page_down");
-    
-    lua_pushinteger(L, HONEY_KEY_HOME);
-    lua_setfield(L, -2, "honey_key_home");
-    
-    lua_pushinteger(L, HONEY_KEY_END);
-    lua_setfield(L, -2, "honey_key_end");
-    
-    lua_pushinteger(L, HONEY_KEY_CAPS_LOCK);
-    lua_setfield(L, -2, "honey_key_caps_lock");
-    
-    lua_pushinteger(L, HONEY_KEY_SCROLL_LOCK);
-    lua_setfield(L, -2, "honey_key_scroll_lock");
-    
-    lua_pushinteger(L, HONEY_KEY_NUM_LOCK);
-    lua_setfield(L, -2, "honey_key_num_lock");
-    
-    lua_pushinteger(L, HONEY_KEY_PRINT_SCREEN);
-    lua_setfield(L, -2, "honey_key_print_screen");
-    
-    lua_pushinteger(L, HONEY_KEY_PAUSE);
-    lua_setfield(L, -2, "honey_key_pause");
-    
-    lua_pushinteger(L, HONEY_KEY_F1);
-    lua_setfield(L, -2, "honey_key_f1");
-    
-    lua_pushinteger(L, HONEY_KEY_F2);
-    lua_setfield(L, -2, "honey_key_f2");
-    
-    lua_pushinteger(L, HONEY_KEY_F3);
-    lua_setfield(L, -2, "honey_key_f3");
-    
-    lua_pushinteger(L, HONEY_KEY_F4);
-    lua_setfield(L, -2, "honey_key_f4");
-    
-    lua_pushinteger(L, HONEY_KEY_F5);
-    lua_setfield(L, -2, "honey_key_f5");
-    
-    lua_pushinteger(L, HONEY_KEY_F6);
-    lua_setfield(L, -2, "honey_key_f6");
-    
-    lua_pushinteger(L, HONEY_KEY_F7);
-    lua_setfield(L, -2, "honey_key_f7");
-    
-    lua_pushinteger(L, HONEY_KEY_F8);
-    lua_setfield(L, -2, "honey_key_f8");
-    
-    lua_pushinteger(L, HONEY_KEY_F9);
-    lua_setfield(L, -2, "honey_key_f9");
-    
-    lua_pushinteger(L, HONEY_KEY_F10);
-    lua_setfield(L, -2, "honey_key_f10");
-    
-    lua_pushinteger(L, HONEY_KEY_F11);
-    lua_setfield(L, -2, "honey_key_f11");
-    
-    lua_pushinteger(L, HONEY_KEY_F12);
-    lua_setfield(L, -2, "honey_key_f12");
-    
-    lua_pushinteger(L, HONEY_KEY_F13);
-    lua_setfield(L, -2, "honey_key_f13");
-    
-    lua_pushinteger(L, HONEY_KEY_F14);
-    lua_setfield(L, -2, "honey_key_f14");
-    
-    lua_pushinteger(L, HONEY_KEY_F15);
-    lua_setfield(L, -2, "honey_key_f15");
-    
-    lua_pushinteger(L, HONEY_KEY_F16);
-    lua_setfield(L, -2, "honey_key_f16");
-    
-    lua_pushinteger(L, HONEY_KEY_F17);
-    lua_setfield(L, -2, "honey_key_f17");
-    
-    lua_pushinteger(L, HONEY_KEY_F18);
-    lua_setfield(L, -2, "honey_key_f18");
-    
-    lua_pushinteger(L, HONEY_KEY_F19);
-    lua_setfield(L, -2, "honey_key_f19");
-    
-    lua_pushinteger(L, HONEY_KEY_F20);
-    lua_setfield(L, -2, "honey_key_f20");
-    
-    lua_pushinteger(L, HONEY_KEY_F21);
-    lua_setfield(L, -2, "honey_key_f21");
-    
-    lua_pushinteger(L, HONEY_KEY_F22);
-    lua_setfield(L, -2, "honey_key_f22");
-    
-    lua_pushinteger(L, HONEY_KEY_F23);
-    lua_setfield(L, -2, "honey_key_f23");
-    
-    lua_pushinteger(L, HONEY_KEY_F24);
-    lua_setfield(L, -2, "honey_key_f24");
-    
-    lua_pushinteger(L, HONEY_KEY_F25);
-    lua_setfield(L, -2, "honey_key_f25");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_0);
-    lua_setfield(L, -2, "honey_key_kp_0");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_1);
-    lua_setfield(L, -2, "honey_key_kp_1");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_2);
-    lua_setfield(L, -2, "honey_key_kp_2");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_3);
-    lua_setfield(L, -2, "honey_key_kp_3");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_4);
-    lua_setfield(L, -2, "honey_key_kp_4");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_5);
-    lua_setfield(L, -2, "honey_key_kp_5");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_6);
-    lua_setfield(L, -2, "honey_key_kp_6");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_7);
-    lua_setfield(L, -2, "honey_key_kp_7");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_8);
-    lua_setfield(L, -2, "honey_key_kp_8");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_9);
-    lua_setfield(L, -2, "honey_key_kp_9");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_DECIMAL);
-    lua_setfield(L, -2, "honey_key_kp_decimal");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_DIVIDE);
-    lua_setfield(L, -2, "honey_key_kp_divide");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_MULTIPLY);
-    lua_setfield(L, -2, "honey_key_kp_multiply");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_SUBTRACT);
-    lua_setfield(L, -2, "honey_key_kp_subtract");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_ADD);
-    lua_setfield(L, -2, "honey_key_kp_add");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_ENTER);
-    lua_setfield(L, -2, "honey_key_kp_enter");
-    
-    lua_pushinteger(L, HONEY_KEY_KP_EQUAL);
-    lua_setfield(L, -2, "honey_key_kp_equal");
-    
-    lua_pushinteger(L, HONEY_KEY_LEFT_SHIFT);
-    lua_setfield(L, -2, "honey_key_left_shift");
-    
-    lua_pushinteger(L, HONEY_KEY_LEFT_CONTROL);
-    lua_setfield(L, -2, "honey_key_left_control");
-    
-    lua_pushinteger(L, HONEY_KEY_LEFT_ALT);
-    lua_setfield(L, -2, "honey_key_left_alt");
-    
-    lua_pushinteger(L, HONEY_KEY_LEFT_SUPER);
-    lua_setfield(L, -2, "honey_key_left_super");
-    
-    lua_pushinteger(L, HONEY_KEY_RIGHT_SHIFT);
-    lua_setfield(L, -2, "honey_key_right_shift");
-    
-    lua_pushinteger(L, HONEY_KEY_RIGHT_CONTROL);
-    lua_setfield(L, -2, "honey_key_right_control");
-    
-    lua_pushinteger(L, HONEY_KEY_RIGHT_ALT);
-    lua_setfield(L, -2, "honey_key_right_alt");
-    
-    lua_pushinteger(L, HONEY_KEY_RIGHT_SUPER);
-    lua_setfield(L, -2, "honey_key_right_super");
-    
-    lua_pushinteger(L, HONEY_KEY_MENU);
-    lua_setfield(L, -2, "honey_key_menu");
+    honey_lua_element elements[] = {
+	{ "honey_key_unknown", HONEY_INT, { HONEY_KEY_UNKNOWN } },
+	{ "honey_key_space", HONEY_INT, { HONEY_KEY_SPACE } },
+	{ "honey_key_apostrophe", HONEY_INT, { HONEY_KEY_APOSTROPHE } },
+	{ "honey_key_comma", HONEY_INT, { HONEY_KEY_COMMA } },
+	{ "honey_key_minus", HONEY_INT, { HONEY_KEY_MINUS } },
+	{ "honey_key_period", HONEY_INT, { HONEY_KEY_PERIOD } },
+	{ "honey_key_slash", HONEY_INT, { HONEY_KEY_SLASH } },
+	{ "honey_key_0", HONEY_INT, { HONEY_KEY_0 } },
+	{ "honey_key_1", HONEY_INT, { HONEY_KEY_1 } },
+	{ "honey_key_2", HONEY_INT, { HONEY_KEY_2 } },
+	{ "honey_key_3", HONEY_INT, { HONEY_KEY_3 } },
+	{ "honey_key_4", HONEY_INT, { HONEY_KEY_4 } },
+	{ "honey_key_5", HONEY_INT, { HONEY_KEY_5 } },
+	{ "honey_key_6", HONEY_INT, { HONEY_KEY_6 } },
+	{ "honey_key_7", HONEY_INT, { HONEY_KEY_7 } },
+	{ "honey_key_8", HONEY_INT, { HONEY_KEY_8 } },
+	{ "honey_key_9", HONEY_INT, { HONEY_KEY_9 } },
+	{ "honey_key_semicolon", HONEY_INT, { HONEY_KEY_SEMICOLON } },
+	{ "honey_key_equal", HONEY_INT, { HONEY_KEY_EQUAL } },
+	{ "honey_key_a", HONEY_INT, { HONEY_KEY_A } },
+	{ "honey_key_b", HONEY_INT, { HONEY_KEY_B } },
+	{ "honey_key_c", HONEY_INT, { HONEY_KEY_C } },
+	{ "honey_key_d", HONEY_INT, { HONEY_KEY_D } },
+	{ "honey_key_e", HONEY_INT, { HONEY_KEY_E } },
+	{ "honey_key_f", HONEY_INT, { HONEY_KEY_F } },
+	{ "honey_key_g", HONEY_INT, { HONEY_KEY_G } },
+	{ "honey_key_h", HONEY_INT, { HONEY_KEY_H } },
+	{ "honey_key_i", HONEY_INT, { HONEY_KEY_I } },
+	{ "honey_key_j", HONEY_INT, { HONEY_KEY_J } },
+	{ "honey_key_k", HONEY_INT, { HONEY_KEY_K } },
+	{ "honey_key_l", HONEY_INT, { HONEY_KEY_L } },
+	{ "honey_key_m", HONEY_INT, { HONEY_KEY_M } },
+	{ "honey_key_n", HONEY_INT, { HONEY_KEY_N } },
+	{ "honey_key_o", HONEY_INT, { HONEY_KEY_O } },
+	{ "honey_key_p", HONEY_INT, { HONEY_KEY_P } },
+	{ "honey_key_q", HONEY_INT, { HONEY_KEY_Q } },
+	{ "honey_key_r", HONEY_INT, { HONEY_KEY_R } },
+	{ "honey_key_s", HONEY_INT, { HONEY_KEY_S } },
+	{ "honey_key_t", HONEY_INT, { HONEY_KEY_T } },
+	{ "honey_key_u", HONEY_INT, { HONEY_KEY_U } },
+	{ "honey_key_v", HONEY_INT, { HONEY_KEY_V } },
+	{ "honey_key_w", HONEY_INT, { HONEY_KEY_W } },
+	{ "honey_key_x", HONEY_INT, { HONEY_KEY_X } },
+	{ "honey_key_y", HONEY_INT, { HONEY_KEY_Y } },
+	{ "honey_key_z", HONEY_INT, { HONEY_KEY_Z } },
+	{ "honey_key_left_bracket", HONEY_INT, { HONEY_KEY_LEFT_BRACKET } },
+	{ "honey_key_backslash", HONEY_INT, { HONEY_KEY_BACKSLASH } },
+	{ "honey_key_right_bracket", HONEY_INT, { HONEY_KEY_RIGHT_BRACKET } },
+	{ "honey_key_grave_accent", HONEY_INT, { HONEY_KEY_GRAVE_ACCENT } },
+	{ "honey_key_world_1", HONEY_INT, { HONEY_KEY_WORLD_1 } },
+	{ "honey_key_world_2", HONEY_INT, { HONEY_KEY_WORLD_2 } },
+	{ "honey_key_escape", HONEY_INT, { HONEY_KEY_ESCAPE } },
+	{ "honey_key_enter", HONEY_INT, { HONEY_KEY_ENTER } },
+	{ "honey_key_tab", HONEY_INT, { HONEY_KEY_TAB } },
+	{ "honey_key_backspace", HONEY_INT, { HONEY_KEY_BACKSPACE } },
+	{ "honey_key_insert", HONEY_INT, { HONEY_KEY_INSERT } },
+	{ "honey_key_delete", HONEY_INT, { HONEY_KEY_DELETE } },
+	{ "honey_key_right", HONEY_INT, { HONEY_KEY_RIGHT } },
+	{ "honey_key_left", HONEY_INT, { HONEY_KEY_LEFT } },
+	{ "honey_key_down", HONEY_INT, { HONEY_KEY_DOWN } },
+	{ "honey_key_up", HONEY_INT, { HONEY_KEY_UP } },
+	{ "honey_key_page_up", HONEY_INT, { HONEY_KEY_PAGE_UP } },
+	{ "honey_key_page_down", HONEY_INT, { HONEY_KEY_PAGE_DOWN } },
+	{ "honey_key_home", HONEY_INT, { HONEY_KEY_HOME } },
+	{ "honey_key_end", HONEY_INT, { HONEY_KEY_END } },
+	{ "honey_key_caps_lock", HONEY_INT, { HONEY_KEY_CAPS_LOCK } },
+	{ "honey_key_scroll_lock", HONEY_INT, { HONEY_KEY_SCROLL_LOCK } },
+	{ "honey_key_num_lock", HONEY_INT, { HONEY_KEY_NUM_LOCK } },
+	{ "honey_key_print_screen", HONEY_INT, { HONEY_KEY_PRINT_SCREEN } },
+	{ "honey_key_pause", HONEY_INT, { HONEY_KEY_PAUSE } },
+	{ "honey_key_f1", HONEY_INT, { HONEY_KEY_F1 } },
+	{ "honey_key_f2", HONEY_INT, { HONEY_KEY_F2 } },
+	{ "honey_key_f3", HONEY_INT, { HONEY_KEY_F3 } },
+	{ "honey_key_f4", HONEY_INT, { HONEY_KEY_F4 } },
+	{ "honey_key_f5", HONEY_INT, { HONEY_KEY_F5 } },
+	{ "honey_key_f6", HONEY_INT, { HONEY_KEY_F6 } },
+	{ "honey_key_f7", HONEY_INT, { HONEY_KEY_F7 } },
+	{ "honey_key_f8", HONEY_INT, { HONEY_KEY_F8 } },
+	{ "honey_key_f9", HONEY_INT, { HONEY_KEY_F9 } },
+	{ "honey_key_f10", HONEY_INT, { HONEY_KEY_F10 } },
+	{ "honey_key_f11", HONEY_INT, { HONEY_KEY_F11 } },
+	{ "honey_key_f12", HONEY_INT, { HONEY_KEY_F12 } },
+	{ "honey_key_f13", HONEY_INT, { HONEY_KEY_F13 } },
+	{ "honey_key_f14", HONEY_INT, { HONEY_KEY_F14 } },
+	{ "honey_key_f15", HONEY_INT, { HONEY_KEY_F15 } },
+	{ "honey_key_f16", HONEY_INT, { HONEY_KEY_F16 } },
+	{ "honey_key_f17", HONEY_INT, { HONEY_KEY_F17 } },
+	{ "honey_key_f18", HONEY_INT, { HONEY_KEY_F18 } },
+	{ "honey_key_f19", HONEY_INT, { HONEY_KEY_F19 } },
+	{ "honey_key_f20", HONEY_INT, { HONEY_KEY_F20 } },
+	{ "honey_key_f21", HONEY_INT, { HONEY_KEY_F21 } },
+	{ "honey_key_f22", HONEY_INT, { HONEY_KEY_F22 } },
+	{ "honey_key_f23", HONEY_INT, { HONEY_KEY_F23 } },
+	{ "honey_key_f24", HONEY_INT, { HONEY_KEY_F24 } },
+	{ "honey_key_f25", HONEY_INT, { HONEY_KEY_F25 } },
+	{ "honey_key_kp_0", HONEY_INT, { HONEY_KEY_KP_0 } },
+	{ "honey_key_kp_1", HONEY_INT, { HONEY_KEY_KP_1 } },
+	{ "honey_key_kp_2", HONEY_INT, { HONEY_KEY_KP_2 } },
+	{ "honey_key_kp_3", HONEY_INT, { HONEY_KEY_KP_3 } },
+	{ "honey_key_kp_4", HONEY_INT, { HONEY_KEY_KP_4 } },
+	{ "honey_key_kp_5", HONEY_INT, { HONEY_KEY_KP_5 } },
+	{ "honey_key_kp_6", HONEY_INT, { HONEY_KEY_KP_6 } },
+	{ "honey_key_kp_7", HONEY_INT, { HONEY_KEY_KP_7 } },
+	{ "honey_key_kp_8", HONEY_INT, { HONEY_KEY_KP_8 } },
+	{ "honey_key_kp_9", HONEY_INT, { HONEY_KEY_KP_9 } },
+	{ "honey_key_kp_decimal", HONEY_INT, { HONEY_KEY_KP_DECIMAL } },
+	{ "honey_key_kp_divide", HONEY_INT, { HONEY_KEY_KP_DIVIDE } },
+	{ "honey_key_kp_multiply", HONEY_INT, { HONEY_KEY_KP_MULTIPLY } },
+	{ "honey_key_kp_subtract", HONEY_INT, { HONEY_KEY_KP_SUBTRACT } },
+	{ "honey_key_kp_add", HONEY_INT, { HONEY_KEY_KP_ADD } },
+	{ "honey_key_kp_enter", HONEY_INT, { HONEY_KEY_KP_ENTER } },
+	{ "honey_key_kp_equal", HONEY_INT, { HONEY_KEY_KP_EQUAL } },
+	{ "honey_key_left_shift", HONEY_INT, { HONEY_KEY_LEFT_SHIFT } },
+	{ "honey_key_left_control", HONEY_INT, { HONEY_KEY_LEFT_CONTROL } },
+	{ "honey_key_left_alt", HONEY_INT, { HONEY_KEY_LEFT_ALT } },
+	{ "honey_key_left_super", HONEY_INT, { HONEY_KEY_LEFT_SUPER } },
+	{ "honey_key_right_shift", HONEY_INT, { HONEY_KEY_RIGHT_SHIFT } },
+	{ "honey_key_right_control", HONEY_INT, { HONEY_KEY_RIGHT_CONTROL } },
+	{ "honey_key_right_alt", HONEY_INT, { HONEY_KEY_RIGHT_ALT } },
+	{ "honey_key_right_super", HONEY_INT, { HONEY_KEY_RIGHT_SUPER } },
+	{ "honey_key_menu", HONEY_INT, { HONEY_KEY_MENU } }
+    };
+
+    honey_lua_create_table(L, elements, HONEY_N_KEYS);
 }
 
 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
diff --git a/src/input/input.h b/src/input/input.h
index a8ae206..f94d520 100644
--- a/src/input/input.h
+++ b/src/input/input.h
@@ -7,6 +7,7 @@
  */
 
 #include "../common.h"
+#include "../lua/honey_lua.h"
 
 #define HONEY_KEY_UNKNOWN 0
 #define HONEY_KEY_SPACE 1
diff --git a/src/lua/honey_lua.c b/src/lua/honey_lua.c
new file mode 100644
index 0000000..36ca335
--- /dev/null
+++ b/src/lua/honey_lua.c
@@ -0,0 +1,40 @@
+#include "honey_lua.h"
+
+void honey_lua_create_table(lua_State* L,
+			    honey_lua_element* elements,
+			    unsigned int n_elements)
+{
+    lua_createtable(L, 0, n_elements);
+
+    for (int i=0; i<n_elements; i++) {
+	honey_lua_push_element(L, elements[i]);
+	lua_setfield(L, -2, elements[i].name);
+    }
+}
+
+/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
+
+void honey_lua_push_element(lua_State* L, honey_lua_element element)
+{
+    switch(element.type) {
+    case HONEY_INT:
+	lua_pushinteger(L, element.data.integer);
+	break;
+
+    case HONEY_NUM:
+	lua_pushnumber(L, element.data.number);
+	break;
+
+    case HONEY_STRING:
+	lua_pushstring(L, element.data.string);
+	break;
+
+    case HONEY_FUNC:
+	lua_pushcfunction(L, element.data.function);
+	break;
+
+    default:
+	// this should never happen
+	break;
+    }
+}
diff --git a/src/lua/honey_lua.h b/src/lua/honey_lua.h
new file mode 100644
index 0000000..90fc2c7
--- /dev/null
+++ b/src/lua/honey_lua.h
@@ -0,0 +1,46 @@
+#ifndef HONEY_LUA_H
+#define HONEY_LUA_H
+
+#include "../common.h"
+
+typedef enum {
+    HONEY_INT,
+    HONEY_NUM,
+    HONEY_STRING,
+    HONEY_FUNC
+} honey_lua_type;
+
+typedef struct {
+    char* name;
+    honey_lua_type type;
+    union {
+	int integer;
+	double number;
+	char* string;
+	int (*function)(lua_State*);
+    } data;
+} honey_lua_element;
+
+/** @brief Push an element to the lua stack.
+ *
+ * @param[in] L The lua state to push the element to.
+ * @param[in] element The honey_lua_element to push to the stack.
+ *
+ * @returns Nothing.
+ */
+void honey_lua_push_element(lua_State* L,
+			    honey_lua_element element);
+
+/** @brief Create a lua table populated with various elements.
+ *
+ * @param[in] L The lua state to push the table to.
+ * @param[in] elements Array of elements to populate the table.
+ * @param[in] n_elements The number of elements in the array.
+ *
+ * @returns Nothing.
+ */
+void honey_lua_create_table(lua_State* L,
+			    honey_lua_element* elements,
+			    unsigned int n_elements);
+
+#endif
-- 
cgit v1.2.1