Haka
state.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 #ifndef HAKA_LUA_STATE_H
6 #define HAKA_LUA_STATE_H
7 
8 #include <haka/types.h>
9 #include <wchar.h>
10 
11 struct lua_State;
12 struct lua_Debug;
13 
14 struct lua_state {
15  struct lua_State *L;
16 };
17 
18 typedef int (*lua_function)(struct lua_State *L);
19 typedef void (*lua_hook)(struct lua_State *L, struct lua_Debug *ar);
20 
21 struct lua_state *lua_state_init();
22 void lua_state_close(struct lua_state *state);
23 bool lua_state_require(struct lua_state *state, const char *module);
24 bool lua_state_isvalid(struct lua_state *state);
25 bool lua_state_interrupt(struct lua_state *state, lua_function func, void *data, void (*destroy)(void *));
26 bool lua_state_runinterrupt(struct lua_state *state);
27 bool lua_state_setdebugger_hook(struct lua_state *state, lua_hook hook);
28 bool lua_state_run_file(struct lua_state *L, const char *filename, int argc, char *argv[]);
29 void lua_state_trigger_haka_event(struct lua_state *state, const char *event);
30 
31 int lua_state_error_formater(struct lua_State *L);
32 void lua_state_print_error(struct lua_State *L, const char *msg);
33 struct lua_state *lua_state_get(struct lua_State *L);
34 
35 extern void (*lua_state_error_hook)(struct lua_State *L);
36 
37 #if HAKA_LUA52
38 void lua_getfenv(struct lua_State *L, int index);
39 int lua_setfenv(struct lua_State *L, int index);
40 #endif
41 
42 #endif /* HAKA_LUA_STATE_H */
Definition: module.h:34