After googling around for a bit I managed to identify how to do this for functions with no parameters but I did not manage to identify how to pass parameters, I tried this but that
resulted in an attempt to call a number value, any help would be appreciated
Code:
int keyboard_lua_callback = 0;
void foo_keyboard_callback(unsigned char key, int x, int y) {
	if ( keyboard_lua_callback == 0 ) return;
	lua_rawgeti( g_L, LUA_REGISTRYINDEX, keyboard_lua_callback );
	lua_pushvalue( g_L, 1 );
	lua_pushinteger( g_L, key );
	lua_pushinteger( g_L, x );
	lua_pushinteger( g_L, y );
	if ( 0 != lua_pcall( g_L, 0, 0, 0 ) ) {
		printf("%s\n", lua_tostring( g_L, -1 ) );
		return;
	}
}
static int foo_glutKeyboardFunc( lua_State *L ) {
	if ( lua_isfunction(L,-1) ) {
		keyboard_lua_callback = luaL_ref( L, LUA_REGISTRYINDEX );
		glutKeyboardFunc(foo_keyboard_callback);
		lua_pushboolean(L,1);
	}
	else {
		glutKeyboardFunc(NULL);
		lua_pushboolean(L,0);
	}
	return 1;
}