Haka: include/haka/lua/object.h Source File

Haka

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

object.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_OBJECT_H
6 #define HAKA_LUA_OBJECT_H
7
8 #include <haka/types.h>
9
10 struct lua_state;
11 struct lua_State;
12
13
14 /*
15 * Lua object management
16 * This type allow to safely share an object between the C
17 * and Lua by taking care of never keeping in Lua a reference
18 * on a userdata that has been destroyed.
19 */
20
21 struct lua_object {
22 struct lua_state *state;
23 };
24
25 #define LUA_OBJECT_INIT { NULL }
26 extern const struct lua_object lua_object_init;
27
28 void lua_object_initialize(struct lua_State *L);
29 bool lua_object_ownedbylua(struct lua_object *obj);
30 void lua_object_release(void *ptr, struct lua_object *obj);
31
32 #endif /* HAKA_LUA_OBJECT_H */
types.h