moonscript/tests/outputs/syntax.lua

90 lines
2.1 KiB
Lua

local x = function() print(what) end
local _ = function() end
_ = function()
return function() return function() end end
end
go(to(the(barn)))
open(function() the(function() return door end) end)
open(function()
the(door)
local hello = function() my(func) end
end)
local h = function() return hi end
eat(function() end, world)
local a = 1 + 2 * 3 / 6
local bunch, go, here
a, bunch, go, here = another, world
func(arg1, arg2, another, arg3)
local we
here, we = function() end, yeah
local the, different = function() return approach end, yeah
dad()
dad(lord)
hello(one, two)();
(5 + 5)(world)
fun(a)(b)
fun(a)(b)
fun(a)(b, bad(hello))
hello(world(what(are(you(doing(here))))))
what(the)[3243](world, yeck(heck))
hairy[hands][are](gross)(okay(okay[world]));
(get[something] + 5)[years]
local i
i, x = 200, 300
local yeah = (1 + 5) * 3
yeah = ((1 + 5) * 3) / 2
yeah = ((1 + 5) * 3) / 2 + i % 100
local whoa = (1 + 2) * (3 + 4) * (4 + 5);
(function() end)()
return(5 + function() return 4 + 2 end)
return(5 + (function() return 4 end) + 2)
print(5 + function()
_ = 34
good(nads)
end)
something('else', "ya")
something('else')
something("else")
here(we)("go")[12123]
local something = { test = 12323, what = function() print("hello world") end }
print(something.test)
local frick = { hello = "world" }
local argon = { num = 100, world = function(self)
print(self.num)
return({ something = function() print("hi from something") end })
end, somethin = function(self,str)
print("string is", str)
return({ world = function(a,b) print("sum", a + b) end })
end }
something.what()
argon:world().something()
argon:somethin("200").world(1, 2)
x = -434
x = -hello(world(one(two)))
local hi = -"herfef"
x = -(function()
local tmp = {}
for x in x do
table.insert(tmp, x)
end
return tmp
end)()
if cool then
print("hello")
end
print("nutjob")
if hello then
_ = 343
end
if cool then
print("what")
else
_ = whack
end
local arg = { ... }
x = function(...) dump({ ... }) end
x = not true
local y = not (5 + 5)
y = #"hello"
x = #{ #{ }, #{ 1 }, #{ 1, 2 } }
_ = hello, world