-loadpal now loads a palette from disk and returns it in a table.

-setpal sets a palette from a table as the current palette.
This commit is contained in:
2022-10-05 18:51:26 +02:00
parent 8415841c5c
commit 035d82c1ec
3 changed files with 184 additions and 136 deletions

305
lua.cpp
View File

@@ -54,9 +54,51 @@ extern "C" {
static int cpp_loadpal(lua_State *L) {
const char* str = luaL_checkstring(L, 1);
loadpal(str);
uint32_t *pal = loadpal(str);
lua_createtable(L, 2, 0);
for (int i=0;i<=256;++i) {
uint32_t color = pal[i];
lua_createtable(L, 0, 3);
lua_pushinteger(L, (color>>16)&0xff);
lua_setfield(L, -2, "r");
lua_pushinteger(L, (color>>8)&0xff);
lua_setfield(L, -2, "g");
lua_pushinteger(L, color&0xff);
lua_setfield(L, -2, "b");
lua_rawseti(L, -2, i+1);
}
free(pal);
return 1;
}
static int cpp_setpal(lua_State *L) {
int r,g,b;
if (lua_istable(L, -1)) {
uint32_t pal[256];
const int len = lua_rawlen(L, -1);
for (int i=1;i<=len;++i) {
lua_rawgeti(L, -1, i);
lua_getfield(L, -1, "r");
r = luaL_checknumber(L, -1);
lua_pop(L, 1);
lua_getfield(L, -1, "g");
g = luaL_checknumber(L, -1);
lua_pop(L, 1);
lua_getfield(L, -1, "b");
b = luaL_checknumber(L, -1);
lua_pop(L, 1);
lua_pop(L, 1);
pal[i-1] = (r<<16)+(g<<8)+b;
}
setpal(pal);
}
return 0;
}
static int cpp_setcolor(lua_State *L) {
uint8_t index = luaL_checkinteger(L, 1);
uint8_t r = luaL_checkinteger(L, 2);
@@ -618,14 +660,13 @@ void push_lua_funcs() {
lua_pushcfunction(L,cpp_cls); lua_setglobal(L, "cls");
lua_pushcfunction(L,cpp_color); lua_setglobal(L, "color");
lua_pushcfunction(L,cpp_loadpal); lua_setglobal(L, "loadpal");
lua_pushcfunction(L,cpp_setcolor); lua_setglobal(L, "setcolor");
lua_pushcfunction(L,cpp_getcolor); lua_setglobal(L, "getcolor");
lua_pushcfunction(L,cpp_settrans); lua_setglobal(L, "settrans");
lua_pushcfunction(L,cpp_gettrans); lua_setglobal(L, "gettrans");
lua_pushcfunction(L,cpp_loadpal); lua_setglobal(L, "loadpal");
lua_pushcfunction(L,cpp_setpal); lua_setglobal(L, "setpal");
lua_pushcfunction(L,cpp_setcolor); lua_setglobal(L, "setcolor");
lua_pushcfunction(L,cpp_getcolor); lua_setglobal(L, "getcolor");
lua_pushcfunction(L,cpp_settrans); lua_setglobal(L, "settrans");
lua_pushcfunction(L,cpp_gettrans); lua_setglobal(L, "gettrans");
/*lua_pushcfunction(L,cpp_pal); lua_setglobal(L, "pal");
lua_pushcfunction(L,cpp_palt); lua_setglobal(L, "palt");*/
lua_pushcfunction(L,cpp_pset); lua_setglobal(L, "pset");
lua_pushcfunction(L,cpp_pget); lua_setglobal(L, "pget");
lua_pushcfunction(L,cpp_line); lua_setglobal(L, "line");
@@ -656,7 +697,7 @@ void push_lua_funcs() {
lua_pushcfunction(L,cpp_mousex); lua_setglobal(L, "mousex");
lua_pushcfunction(L,cpp_mousey); lua_setglobal(L, "mousey");
lua_pushcfunction(L,cpp_mwheel); lua_setglobal(L, "mwheel");
lua_pushcfunction(L,cpp_mbtn); lua_setglobal(L, "mbtn");
lua_pushcfunction(L,cpp_mbtn); lua_setglobal(L, "mbtn");
lua_pushcfunction(L,cpp_time); lua_setglobal(L, "time");
lua_pushcfunction(L,cpp_abs); lua_setglobal(L, "abs");
@@ -674,133 +715,133 @@ void push_lua_funcs() {
lua_pushcfunction(L,cpp_srand); lua_setglobal(L, "srand");
lua_pushcfunction(L,cpp_tostr); lua_setglobal(L, "tostr");
lua_pushcfunction(L,cpp_ascii); lua_setglobal(L, "ascii");
lua_pushcfunction(L,cpp_strlen); lua_setglobal(L, "strlen");
lua_pushcfunction(L,cpp_strlen); lua_setglobal(L, "strlen");
lua_pushcfunction(L,cpp_fopen); lua_setglobal(L, "fopen");
lua_pushcfunction(L,cpp_fclose); lua_setglobal(L, "fclose");
lua_pushcfunction(L,cpp_fopen); lua_setglobal(L, "fopen");
lua_pushcfunction(L,cpp_fclose); lua_setglobal(L, "fclose");
lua_pushcfunction(L,cpp_feof); lua_setglobal(L, "feof");
lua_pushcfunction(L,cpp_fwritei); lua_setglobal(L, "fwritei");
lua_pushcfunction(L,cpp_fwrited); lua_setglobal(L, "fwrited");
lua_pushcfunction(L,cpp_fwrites); lua_setglobal(L, "fwrites");
lua_pushcfunction(L,cpp_fwritew); lua_setglobal(L, "fwritew");
lua_pushcfunction(L,cpp_fwriteb); lua_setglobal(L, "fwriteb");
lua_pushcfunction(L,cpp_fwriteln); lua_setglobal(L, "fwriteln");
lua_pushcfunction(L,cpp_freadi); lua_setglobal(L, "freadi");
lua_pushcfunction(L,cpp_freadd); lua_setglobal(L, "freadd");
lua_pushcfunction(L,cpp_freads); lua_setglobal(L, "freads");
lua_pushcfunction(L,cpp_freadw); lua_setglobal(L, "freadw");
lua_pushcfunction(L,cpp_freadb); lua_setglobal(L, "freadb");
lua_pushcfunction(L,cpp_fwritei); lua_setglobal(L, "fwritei");
lua_pushcfunction(L,cpp_fwrited); lua_setglobal(L, "fwrited");
lua_pushcfunction(L,cpp_fwrites); lua_setglobal(L, "fwrites");
lua_pushcfunction(L,cpp_fwritew); lua_setglobal(L, "fwritew");
lua_pushcfunction(L,cpp_fwriteb); lua_setglobal(L, "fwriteb");
lua_pushcfunction(L,cpp_fwriteln); lua_setglobal(L, "fwriteln");
lua_pushcfunction(L,cpp_freadi); lua_setglobal(L, "freadi");
lua_pushcfunction(L,cpp_freadd); lua_setglobal(L, "freadd");
lua_pushcfunction(L,cpp_freads); lua_setglobal(L, "freads");
lua_pushcfunction(L,cpp_freadw); lua_setglobal(L, "freadw");
lua_pushcfunction(L,cpp_freadb); lua_setglobal(L, "freadb");
lua_pushinteger(L, 0); lua_setglobal(L, "KEY_UNKNOWN");
lua_pushinteger(L, 4); lua_setglobal(L, "KEY_A");
lua_pushinteger(L, 5); lua_setglobal(L, "KEY_B");
lua_pushinteger(L, 6); lua_setglobal(L, "KEY_C");
lua_pushinteger(L, 7); lua_setglobal(L, "KEY_D");
lua_pushinteger(L, 8); lua_setglobal(L, "KEY_E");
lua_pushinteger(L, 9); lua_setglobal(L, "KEY_F");
lua_pushinteger(L, 10); lua_setglobal(L, "KEY_G");
lua_pushinteger(L, 11); lua_setglobal(L, "KEY_H");
lua_pushinteger(L, 12); lua_setglobal(L, "KEY_I");
lua_pushinteger(L, 13); lua_setglobal(L, "KEY_J");
lua_pushinteger(L, 14); lua_setglobal(L, "KEY_K");
lua_pushinteger(L, 15); lua_setglobal(L, "KEY_L");
lua_pushinteger(L, 16); lua_setglobal(L, "KEY_M");
lua_pushinteger(L, 17); lua_setglobal(L, "KEY_N");
lua_pushinteger(L, 18); lua_setglobal(L, "KEY_O");
lua_pushinteger(L, 19); lua_setglobal(L, "KEY_P");
lua_pushinteger(L, 20); lua_setglobal(L, "KEY_Q");
lua_pushinteger(L, 21); lua_setglobal(L, "KEY_R");
lua_pushinteger(L, 22); lua_setglobal(L, "KEY_S");
lua_pushinteger(L, 23); lua_setglobal(L, "KEY_T");
lua_pushinteger(L, 24); lua_setglobal(L, "KEY_U");
lua_pushinteger(L, 25); lua_setglobal(L, "KEY_V");
lua_pushinteger(L, 26); lua_setglobal(L, "KEY_W");
lua_pushinteger(L, 27); lua_setglobal(L, "KEY_X");
lua_pushinteger(L, 28); lua_setglobal(L, "KEY_Y");
lua_pushinteger(L, 29); lua_setglobal(L, "KEY_Z");
lua_pushinteger(L, 30); lua_setglobal(L, "KEY_1");
lua_pushinteger(L, 31); lua_setglobal(L, "KEY_2");
lua_pushinteger(L, 32); lua_setglobal(L, "KEY_3");
lua_pushinteger(L, 33); lua_setglobal(L, "KEY_4");
lua_pushinteger(L, 34); lua_setglobal(L, "KEY_5");
lua_pushinteger(L, 35); lua_setglobal(L, "KEY_6");
lua_pushinteger(L, 36); lua_setglobal(L, "KEY_7");
lua_pushinteger(L, 37); lua_setglobal(L, "KEY_8");
lua_pushinteger(L, 38); lua_setglobal(L, "KEY_9");
lua_pushinteger(L, 39); lua_setglobal(L, "KEY_0");
lua_pushinteger(L, 40); lua_setglobal(L, "KEY_RETURN");
lua_pushinteger(L, 41); lua_setglobal(L, "KEY_ESCAPE");
lua_pushinteger(L, 42); lua_setglobal(L, "KEY_BACKSPACE");
lua_pushinteger(L, 43); lua_setglobal(L, "KEY_TAB");
lua_pushinteger(L, 44); lua_setglobal(L, "KEY_SPACE");
lua_pushinteger(L, 45); lua_setglobal(L, "KEY_MINUS");
lua_pushinteger(L, 46); lua_setglobal(L, "KEY_EQUALS");
lua_pushinteger(L, 47); lua_setglobal(L, "KEY_LEFTBRACKET");
lua_pushinteger(L, 48); lua_setglobal(L, "KEY_RIGHTBRACKET");
lua_pushinteger(L, 49); lua_setglobal(L, "KEY_BACKSLASH");
lua_pushinteger(L, 50); lua_setglobal(L, "KEY_NONUSHASH");
lua_pushinteger(L, 51); lua_setglobal(L, "KEY_SEMICOLON");
lua_pushinteger(L, 52); lua_setglobal(L, "KEY_APOSTROPHE");
lua_pushinteger(L, 53); lua_setglobal(L, "KEY_GRAVE");
lua_pushinteger(L, 54); lua_setglobal(L, "KEY_COMMA");
lua_pushinteger(L, 55); lua_setglobal(L, "KEY_PERIOD");
lua_pushinteger(L, 56); lua_setglobal(L, "KEY_SLASH");
lua_pushinteger(L, 57); lua_setglobal(L, "KEY_CAPSLOCK");
lua_pushinteger(L, 58); lua_setglobal(L, "KEY_F1");
lua_pushinteger(L, 59); lua_setglobal(L, "KEY_F2");
lua_pushinteger(L, 60); lua_setglobal(L, "KEY_F3");
lua_pushinteger(L, 61); lua_setglobal(L, "KEY_F4");
lua_pushinteger(L, 62); lua_setglobal(L, "KEY_F5");
lua_pushinteger(L, 63); lua_setglobal(L, "KEY_F6");
lua_pushinteger(L, 64); lua_setglobal(L, "KEY_F7");
lua_pushinteger(L, 65); lua_setglobal(L, "KEY_F8");
lua_pushinteger(L, 66); lua_setglobal(L, "KEY_F9");
lua_pushinteger(L, 67); lua_setglobal(L, "KEY_F10");
lua_pushinteger(L, 68); lua_setglobal(L, "KEY_F11");
lua_pushinteger(L, 69); lua_setglobal(L, "KEY_F12");
lua_pushinteger(L, 70); lua_setglobal(L, "KEY_PRINTSCREEN");
lua_pushinteger(L, 71); lua_setglobal(L, "KEY_SCROLLLOCK");
lua_pushinteger(L, 72); lua_setglobal(L, "KEY_PAUSE");
lua_pushinteger(L, 73); lua_setglobal(L, "KEY_INSERT");
lua_pushinteger(L, 74); lua_setglobal(L, "KEY_HOME");
lua_pushinteger(L, 75); lua_setglobal(L, "KEY_PAGEUP");
lua_pushinteger(L, 76); lua_setglobal(L, "KEY_DELETE");
lua_pushinteger(L, 77); lua_setglobal(L, "KEY_END");
lua_pushinteger(L, 78); lua_setglobal(L, "KEY_PAGEDOWN");
lua_pushinteger(L, 79); lua_setglobal(L, "KEY_RIGHT");
lua_pushinteger(L, 80); lua_setglobal(L, "KEY_LEFT");
lua_pushinteger(L, 81); lua_setglobal(L, "KEY_DOWN");
lua_pushinteger(L, 82); lua_setglobal(L, "KEY_UP");
lua_pushinteger(L, 83); lua_setglobal(L, "KEY_NUMLOCKCLEAR");
lua_pushinteger(L, 84); lua_setglobal(L, "KEY_KP_DIVIDE");
lua_pushinteger(L, 85); lua_setglobal(L, "KEY_KP_MULTIPLY");
lua_pushinteger(L, 86); lua_setglobal(L, "KEY_KP_MINUS");
lua_pushinteger(L, 87); lua_setglobal(L, "KEY_KP_PLUS");
lua_pushinteger(L, 88); lua_setglobal(L, "KEY_KP_ENTER");
lua_pushinteger(L, 89); lua_setglobal(L, "KEY_KP_1");
lua_pushinteger(L, 90); lua_setglobal(L, "KEY_KP_2");
lua_pushinteger(L, 91); lua_setglobal(L, "KEY_KP_3");
lua_pushinteger(L, 92); lua_setglobal(L, "KEY_KP_4");
lua_pushinteger(L, 93); lua_setglobal(L, "KEY_KP_5");
lua_pushinteger(L, 94); lua_setglobal(L, "KEY_KP_6");
lua_pushinteger(L, 95); lua_setglobal(L, "KEY_KP_7");
lua_pushinteger(L, 96); lua_setglobal(L, "KEY_KP_8");
lua_pushinteger(L, 97); lua_setglobal(L, "KEY_KP_9");
lua_pushinteger(L, 98); lua_setglobal(L, "KEY_KP_0");
lua_pushinteger(L, 99); lua_setglobal(L, "KEY_KP_PERIOD");
lua_pushinteger(L, 100); lua_setglobal(L, "KEY_NONUSBACKSLASH");
lua_pushinteger(L, 101); lua_setglobal(L, "KEY_APPLICATION");
lua_pushinteger(L, 224); lua_setglobal(L, "KEY_LCTRL");
lua_pushinteger(L, 225); lua_setglobal(L, "KEY_LSHIFT");
lua_pushinteger(L, 226); lua_setglobal(L, "KEY_LALT");
lua_pushinteger(L, 227); lua_setglobal(L, "KEY_LGUI");
lua_pushinteger(L, 228); lua_setglobal(L, "KEY_RCTRL");
lua_pushinteger(L, 229); lua_setglobal(L, "KEY_RSHIFT");
lua_pushinteger(L, 230); lua_setglobal(L, "KEY_RALT");
lua_pushinteger(L, 231); lua_setglobal(L, "KEY_RGUI");
lua_pushinteger(L, 0); lua_setglobal(L, "KEY_UNKNOWN");
lua_pushinteger(L, 4); lua_setglobal(L, "KEY_A");
lua_pushinteger(L, 5); lua_setglobal(L, "KEY_B");
lua_pushinteger(L, 6); lua_setglobal(L, "KEY_C");
lua_pushinteger(L, 7); lua_setglobal(L, "KEY_D");
lua_pushinteger(L, 8); lua_setglobal(L, "KEY_E");
lua_pushinteger(L, 9); lua_setglobal(L, "KEY_F");
lua_pushinteger(L, 10); lua_setglobal(L, "KEY_G");
lua_pushinteger(L, 11); lua_setglobal(L, "KEY_H");
lua_pushinteger(L, 12); lua_setglobal(L, "KEY_I");
lua_pushinteger(L, 13); lua_setglobal(L, "KEY_J");
lua_pushinteger(L, 14); lua_setglobal(L, "KEY_K");
lua_pushinteger(L, 15); lua_setglobal(L, "KEY_L");
lua_pushinteger(L, 16); lua_setglobal(L, "KEY_M");
lua_pushinteger(L, 17); lua_setglobal(L, "KEY_N");
lua_pushinteger(L, 18); lua_setglobal(L, "KEY_O");
lua_pushinteger(L, 19); lua_setglobal(L, "KEY_P");
lua_pushinteger(L, 20); lua_setglobal(L, "KEY_Q");
lua_pushinteger(L, 21); lua_setglobal(L, "KEY_R");
lua_pushinteger(L, 22); lua_setglobal(L, "KEY_S");
lua_pushinteger(L, 23); lua_setglobal(L, "KEY_T");
lua_pushinteger(L, 24); lua_setglobal(L, "KEY_U");
lua_pushinteger(L, 25); lua_setglobal(L, "KEY_V");
lua_pushinteger(L, 26); lua_setglobal(L, "KEY_W");
lua_pushinteger(L, 27); lua_setglobal(L, "KEY_X");
lua_pushinteger(L, 28); lua_setglobal(L, "KEY_Y");
lua_pushinteger(L, 29); lua_setglobal(L, "KEY_Z");
lua_pushinteger(L, 30); lua_setglobal(L, "KEY_1");
lua_pushinteger(L, 31); lua_setglobal(L, "KEY_2");
lua_pushinteger(L, 32); lua_setglobal(L, "KEY_3");
lua_pushinteger(L, 33); lua_setglobal(L, "KEY_4");
lua_pushinteger(L, 34); lua_setglobal(L, "KEY_5");
lua_pushinteger(L, 35); lua_setglobal(L, "KEY_6");
lua_pushinteger(L, 36); lua_setglobal(L, "KEY_7");
lua_pushinteger(L, 37); lua_setglobal(L, "KEY_8");
lua_pushinteger(L, 38); lua_setglobal(L, "KEY_9");
lua_pushinteger(L, 39); lua_setglobal(L, "KEY_0");
lua_pushinteger(L, 40); lua_setglobal(L, "KEY_RETURN");
lua_pushinteger(L, 41); lua_setglobal(L, "KEY_ESCAPE");
lua_pushinteger(L, 42); lua_setglobal(L, "KEY_BACKSPACE");
lua_pushinteger(L, 43); lua_setglobal(L, "KEY_TAB");
lua_pushinteger(L, 44); lua_setglobal(L, "KEY_SPACE");
lua_pushinteger(L, 45); lua_setglobal(L, "KEY_MINUS");
lua_pushinteger(L, 46); lua_setglobal(L, "KEY_EQUALS");
lua_pushinteger(L, 47); lua_setglobal(L, "KEY_LEFTBRACKET");
lua_pushinteger(L, 48); lua_setglobal(L, "KEY_RIGHTBRACKET");
lua_pushinteger(L, 49); lua_setglobal(L, "KEY_BACKSLASH");
lua_pushinteger(L, 50); lua_setglobal(L, "KEY_NONUSHASH");
lua_pushinteger(L, 51); lua_setglobal(L, "KEY_SEMICOLON");
lua_pushinteger(L, 52); lua_setglobal(L, "KEY_APOSTROPHE");
lua_pushinteger(L, 53); lua_setglobal(L, "KEY_GRAVE");
lua_pushinteger(L, 54); lua_setglobal(L, "KEY_COMMA");
lua_pushinteger(L, 55); lua_setglobal(L, "KEY_PERIOD");
lua_pushinteger(L, 56); lua_setglobal(L, "KEY_SLASH");
lua_pushinteger(L, 57); lua_setglobal(L, "KEY_CAPSLOCK");
lua_pushinteger(L, 58); lua_setglobal(L, "KEY_F1");
lua_pushinteger(L, 59); lua_setglobal(L, "KEY_F2");
lua_pushinteger(L, 60); lua_setglobal(L, "KEY_F3");
lua_pushinteger(L, 61); lua_setglobal(L, "KEY_F4");
lua_pushinteger(L, 62); lua_setglobal(L, "KEY_F5");
lua_pushinteger(L, 63); lua_setglobal(L, "KEY_F6");
lua_pushinteger(L, 64); lua_setglobal(L, "KEY_F7");
lua_pushinteger(L, 65); lua_setglobal(L, "KEY_F8");
lua_pushinteger(L, 66); lua_setglobal(L, "KEY_F9");
lua_pushinteger(L, 67); lua_setglobal(L, "KEY_F10");
lua_pushinteger(L, 68); lua_setglobal(L, "KEY_F11");
lua_pushinteger(L, 69); lua_setglobal(L, "KEY_F12");
lua_pushinteger(L, 70); lua_setglobal(L, "KEY_PRINTSCREEN");
lua_pushinteger(L, 71); lua_setglobal(L, "KEY_SCROLLLOCK");
lua_pushinteger(L, 72); lua_setglobal(L, "KEY_PAUSE");
lua_pushinteger(L, 73); lua_setglobal(L, "KEY_INSERT");
lua_pushinteger(L, 74); lua_setglobal(L, "KEY_HOME");
lua_pushinteger(L, 75); lua_setglobal(L, "KEY_PAGEUP");
lua_pushinteger(L, 76); lua_setglobal(L, "KEY_DELETE");
lua_pushinteger(L, 77); lua_setglobal(L, "KEY_END");
lua_pushinteger(L, 78); lua_setglobal(L, "KEY_PAGEDOWN");
lua_pushinteger(L, 79); lua_setglobal(L, "KEY_RIGHT");
lua_pushinteger(L, 80); lua_setglobal(L, "KEY_LEFT");
lua_pushinteger(L, 81); lua_setglobal(L, "KEY_DOWN");
lua_pushinteger(L, 82); lua_setglobal(L, "KEY_UP");
lua_pushinteger(L, 83); lua_setglobal(L, "KEY_NUMLOCKCLEAR");
lua_pushinteger(L, 84); lua_setglobal(L, "KEY_KP_DIVIDE");
lua_pushinteger(L, 85); lua_setglobal(L, "KEY_KP_MULTIPLY");
lua_pushinteger(L, 86); lua_setglobal(L, "KEY_KP_MINUS");
lua_pushinteger(L, 87); lua_setglobal(L, "KEY_KP_PLUS");
lua_pushinteger(L, 88); lua_setglobal(L, "KEY_KP_ENTER");
lua_pushinteger(L, 89); lua_setglobal(L, "KEY_KP_1");
lua_pushinteger(L, 90); lua_setglobal(L, "KEY_KP_2");
lua_pushinteger(L, 91); lua_setglobal(L, "KEY_KP_3");
lua_pushinteger(L, 92); lua_setglobal(L, "KEY_KP_4");
lua_pushinteger(L, 93); lua_setglobal(L, "KEY_KP_5");
lua_pushinteger(L, 94); lua_setglobal(L, "KEY_KP_6");
lua_pushinteger(L, 95); lua_setglobal(L, "KEY_KP_7");
lua_pushinteger(L, 96); lua_setglobal(L, "KEY_KP_8");
lua_pushinteger(L, 97); lua_setglobal(L, "KEY_KP_9");
lua_pushinteger(L, 98); lua_setglobal(L, "KEY_KP_0");
lua_pushinteger(L, 99); lua_setglobal(L, "KEY_KP_PERIOD");
lua_pushinteger(L, 100); lua_setglobal(L, "KEY_NONUSBACKSLASH");
lua_pushinteger(L, 101); lua_setglobal(L, "KEY_APPLICATION");
lua_pushinteger(L, 224); lua_setglobal(L, "KEY_LCTRL");
lua_pushinteger(L, 225); lua_setglobal(L, "KEY_LSHIFT");
lua_pushinteger(L, 226); lua_setglobal(L, "KEY_LALT");
lua_pushinteger(L, 227); lua_setglobal(L, "KEY_LGUI");
lua_pushinteger(L, 228); lua_setglobal(L, "KEY_RCTRL");
lua_pushinteger(L, 229); lua_setglobal(L, "KEY_RSHIFT");
lua_pushinteger(L, 230); lua_setglobal(L, "KEY_RALT");
lua_pushinteger(L, 231); lua_setglobal(L, "KEY_RGUI");
lua_pushinteger(L, 0); lua_setglobal(L, "FILE_READ");
lua_pushinteger(L, 1); lua_setglobal(L, "FILE_WRITE");
lua_pushinteger(L, 0); lua_setglobal(L, "FILE_READ");
lua_pushinteger(L, 1); lua_setglobal(L, "FILE_WRITE");
}
void lua_init(char* filenames) {