forked from TypeScriptToLua/TypeScriptToLua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndex.ts
More file actions
26 lines (23 loc) · 744 Bytes
/
Copy pathIndex.ts
File metadata and controls
26 lines (23 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function __TS__Index(this: void, classProto: LuaObject): (this: void, tbl: LuaObject, key: any) => any {
return (tbl, key) => {
let proto = classProto;
while (true) {
const val = rawget(proto, key);
if (val !== null) {
return val;
}
const getters = rawget(proto, "____getters");
if (getters) {
const getter = getters[key];
if (getter) {
return getter(tbl);
}
}
const base = rawget(rawget(proto, "constructor"), "____super");
if (!base) {
break;
}
proto = rawget(base, "prototype");
}
};
}