commit | author | age
|
6e1425
|
1 |
/* |
H |
2 |
* wax_instance.h |
|
3 |
* Lua |
|
4 |
* |
|
5 |
* Created by ProbablyInteractive on 5/18/09. |
|
6 |
* Copyright 2009 Probably Interactive. All rights reserved. |
|
7 |
* |
|
8 |
*/ |
|
9 |
|
|
10 |
#import <Foundation/Foundation.h> |
|
11 |
#import <objc/runtime.h> |
|
12 |
#import <objc/message.h> |
|
13 |
|
|
14 |
//#import "lua.h" |
|
15 |
#import <lua/lua.h> |
|
16 |
|
|
17 |
#define WAX_INSTANCE_METATABLE_NAME "wax.instance" |
|
18 |
|
|
19 |
typedef struct _wax_instance_userdata { |
|
20 |
id instance; |
|
21 |
BOOL isClass; |
|
22 |
Class isSuper; // isSuper not only stores whether the class is a super, but it also contains the value of the next superClass. |
|
23 |
BOOL actAsSuper; // It only acts like a super once, when it is called for the first time. |
|
24 |
BOOL waxRetain; // TODO: need release instance when gc |
|
25 |
} wax_instance_userdata; |
|
26 |
|
|
27 |
int luaopen_wax_instance(lua_State *L); |
|
28 |
|
|
29 |
wax_instance_userdata *wax_instance_create(lua_State *L, id instance, BOOL isClass); |
|
30 |
wax_instance_userdata *wax_instance_createSuper(lua_State *L, wax_instance_userdata *instanceUserdata); |
|
31 |
void wax_instance_pushUserdataTable(lua_State *L); |
|
32 |
void wax_instance_pushStrongUserdataTable(lua_State *L); |
|
33 |
|
|
34 |
BOOL wax_instance_pushFunction(lua_State *L, id self, SEL selector); |
|
35 |
void wax_instance_pushUserdata(lua_State *L, id object); |
|
36 |
BOOL wax_instance_isWaxClass(id instance); |