Lua keyevents bug, int keycode is cast to a char

This commit is contained in:
Simon Robertshaw 2011-08-22 21:22:21 +01:00
parent ac6feec874
commit 42938cc2ea
2 changed files with 4 additions and 3 deletions

View File

@ -20,7 +20,7 @@
void luacon_open();
int luacon_step(int mx, int my);
int luacon_mouseevent(int mx, int my, int mb, int event);
int luacon_keyevent(char key, int modifier, int event);
int luacon_keyevent(int key, int modifier, int event);
int luacon_eval(char *command);
char *luacon_geterror();
void luacon_close();

View File

@ -74,12 +74,13 @@ void luacon_open(){
lua_pushinteger(l, 0);
lua_setfield(l, tptProperties, "mousey");
}
int luacon_keyevent(char key, int modifier, int event){
int luacon_keyevent(int key, int modifier, int event){
int i = 0, kpcontinue = 1;
char tempkey[] = {(key, 0};
if(keypress_function_count){
for(i = 0; i < keypress_function_count && kpcontinue; i++){
lua_rawgeti(l, LUA_REGISTRYINDEX, keypress_functions[i]);
lua_pushstring(l, &key);
lua_pushstring(l, tempkey);
lua_pushinteger(l, key);
lua_pushinteger(l, modifier);
lua_pushinteger(l, event);