-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
32 lines (27 loc) · 700 Bytes
/
main.lua
File metadata and controls
32 lines (27 loc) · 700 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
27
28
29
30
31
32
inspect = require "inspect"
lang = require "lang"
lang.serializer = inspect
if love then
--arg[1] = "examples/fizzbuzz"
arg[1] = nil
end
if arg[1] then
local file = io.open(arg[1], "r")
local code = file:read("*a")
file:close()
--local start = love.timer.getTime()
local r = lang.run(lang.deserialize(code:gsub("\n", " "))) or ""
--print(love.timer.getTime()-start)
io.write(r)
else
while true do
io.write("\n> ")
local code = io.read()
print("----")
local r = lang.run(lang.deserialize(code:gsub("\n", " ")))
if type(r) ~= "string" then
r = inspect(r)
end
print("\n< "..r)
end
end