-
-
Notifications
You must be signed in to change notification settings - Fork 185
Expand file tree
/
Copy pathlualib.ts
More file actions
21 lines (18 loc) · 723 Bytes
/
lualib.ts
File metadata and controls
21 lines (18 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import * as ts from "typescript";
import * as lua from "../../LuaAST";
import { LuaLibFeature } from "../../LuaLib";
import { TransformationContext } from "../context";
export { LuaLibFeature };
export function importLuaLibFeature(context: TransformationContext, feature: LuaLibFeature): void {
context.usedLuaLibFeatures.add(feature);
}
export function transformLuaLibFunction(
context: TransformationContext,
feature: LuaLibFeature,
tsParent?: ts.Node,
...params: lua.Expression[]
): lua.CallExpression {
importLuaLibFeature(context, feature);
const functionIdentifier = lua.createIdentifier(`__TS__${feature}`);
return lua.createCallExpression(functionIdentifier, params, tsParent);
}