1 #ifndef _lua__hpp__included__
2 #define _lua__hpp__included__
4 #include "core/controllerframe.hpp"
5 #include "core/keymapper.hpp"
6 #include "core/render.hpp"
11 * Function implemented in C++ exported to Lua.
19 lua_function(const std::string
& name
) throw(std::bad_alloc
);
21 * Unregister function.
23 virtual ~lua_function() throw();
28 virtual int invoke(lua_State
* L
) = 0;
34 * Register function pointer as lua function.
36 class function_ptr_luafun
: public lua_function
42 function_ptr_luafun(const std::string
& name
, int (*_fn
)(lua_State
* L
, const std::string
& fname
))
50 int invoke(lua_State
* L
)
55 int (*fn
)(lua_State
* L
, const std::string
& fname
);
58 struct lua_render_context
64 struct render_queue
* queue
;
69 void init_lua() throw();
70 void quit_lua() throw();
71 void lua_callback_do_paint(struct lua_render_context
* ctx
, bool non_synthethic
) throw();
72 void lua_callback_do_video(struct lua_render_context
* ctx
) throw();
73 void lua_callback_do_input(controller_frame
& data
, bool subframe
) throw();
74 void lua_callback_do_reset() throw();
75 void lua_callback_do_frame() throw();
76 void lua_callback_do_frame_emulated() throw();
77 void lua_callback_do_rewind() throw();
78 void lua_callback_do_readwrite() throw();
79 void lua_callback_startup() throw();
80 void lua_callback_do_idle() throw();
81 void lua_callback_do_timer() throw();
82 void lua_callback_pre_load(const std::string
& name
) throw();
83 void lua_callback_err_load(const std::string
& name
) throw();
84 void lua_callback_post_load(const std::string
& name
, bool was_state
) throw();
85 void lua_callback_pre_save(const std::string
& name
, bool is_state
) throw();
86 void lua_callback_err_save(const std::string
& name
) throw();
87 void lua_callback_post_save(const std::string
& name
, bool is_state
) throw();
88 void lua_callback_snoop_input(uint32_t port
, uint32_t controller
, uint32_t index
, short value
) throw();
89 void lua_callback_quit() throw();
90 void lua_callback_keyhook(const std::string
& key
, const struct keygroup::parameters
& p
) throw();
92 #define LUA_TIMED_HOOK_IDLE 0
93 #define LUA_TIMED_HOOK_TIMER 1
95 uint64_t lua_timed_hook(int timer
) throw();
97 extern bool lua_supported
;
98 extern bool lua_requests_repaint
;
99 extern bool lua_requests_subframe_paint
;