forked from TypeScriptToLua/TypeScriptToLua.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.lua
More file actions
36 lines (32 loc) · 1.33 KB
/
setup.lua
File metadata and controls
36 lines (32 loc) · 1.33 KB
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
27
28
29
30
31
32
33
34
35
36
do
local js = require("js")
local function pushToPrintStream(method, ...)
js.global.printStream:push({
method = method,
data = { ____tstlArrayLength = select("#", ...), ... },
})
end
console = {
assert = function(_, ...) pushToPrintStream("assert", ...) end,
clear = function(_, ...) pushToPrintStream("clear", ...) end,
count = function(_, ...) pushToPrintStream("count", ...) end,
debug = function(_, ...) pushToPrintStream("debug", ...) end,
error = function(_, ...) pushToPrintStream("error", ...) end,
info = function(_, ...) pushToPrintStream("info", ...) end,
log = function(_, ...) pushToPrintStream("log", ...) end,
table = function(_, ...) pushToPrintStream("table", ...) end,
time = function(_, ...) pushToPrintStream("time", ...) end,
timeEnd = function(_, ...) pushToPrintStream("timeEnd", ...) end,
warn = function(_, ...) pushToPrintStream("warn", ...) end,
}
print = function(...)
local elements = {}
for i = 1, select("#", ...) do
table.insert(elements, tostring(select(i, ...)))
end
pushToPrintStream("log", table.concat(elements, "\t"))
end
-- Don't try to resolve required modules
package.path = ""
package.jspath = ""
end