Skip to content

Commit abbdd03

Browse files
author
Aeomi
authored
Merge pull request #2 from Perryvw/master
update
2 parents 2d1e708 + e74340f commit abbdd03

5 files changed

Lines changed: 23 additions & 6 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "typescript-to-lua",
33
"license": "MIT",
4-
"version": "0.1.4",
4+
"version": "0.1.5",
55
"repository": "https://github.com/Perryvw/TypescriptToLua",
66
"scripts": {
77
"build": "tsc -p tsconfig.json",
@@ -21,7 +21,8 @@
2121
"node": ">=8.5.0"
2222
},
2323
"dependencies": {
24-
"yargs": "^11.0.0"
24+
"yargs": "^11.0.0",
25+
"typescript": "^2.7.2"
2526
},
2627
"devDependencies": {
2728
"@types/node": "^9.4.7",
@@ -31,7 +32,6 @@
3132
"deep-equal": "^1.0.1",
3233
"lua.vm.js": "0.0.1",
3334
"nyc": "^11.5.0",
34-
"tslint": "^5.9.1",
35-
"typescript": "^2.7.2"
35+
"tslint": "^5.9.1"
3636
}
3737
}

src/Transpiler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ export class LuaTranspiler {
833833

834834
public transpileNewExpression(node: ts.NewExpression): string {
835835
const name = this.transpileExpression(node.expression);
836-
const params = this.transpileArguments(node.arguments, ts.createTrue());
836+
const params = node.arguments ? this.transpileArguments(node.arguments, ts.createTrue()) : "true";
837837

838838
return `${name}.new(${params})`;
839839
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Test = Test or {}
2+
Test.__index = Test
3+
function Test.new(construct, ...)
4+
local instance = setmetatable({}, Test)
5+
if construct and Test.constructor then Test.constructor(instance, ...) end
6+
return instance
7+
end
8+
function Test.constructor(self)
9+
end
10+
local t = Test.new(true)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Test {
2+
constructor () {
3+
4+
}
5+
}
6+
7+
let t = new Test;

0 commit comments

Comments
 (0)