Haka
ref.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_REF_H
6 #define HAKA_LUA_REF_H
7 
8 #include <haka/types.h>
9 
10 
11 struct lua_state;
12 struct lua_State;
13 
14 
15 /*
16  * Lua reference management
17  */
18 
19 struct lua_ref {
20  struct lua_state *state;
21  int ref;
22  bool weak:1;
23 };
24 
25 void lua_ref_init_state(struct lua_State *L);
26 void lua_ref_init(struct lua_ref *ref);
27 bool lua_ref_isvalid(struct lua_ref *ref);
28 void lua_ref_get(struct lua_State *state, struct lua_ref *ref, int index, bool weak);
29 bool lua_ref_clear(struct lua_ref *ref);
30 void lua_ref_push(struct lua_State *state, struct lua_ref *ref);
31 
32 #endif /* HAKA_LUA_REF_H */