-
Notifications
You must be signed in to change notification settings - Fork 196
Closed
Description
So the following code:
(arg1, arg2) ->
with table_with_functions
return {
.fn1("work")
.fn2("more work")
}
My intent is to have a function return a table that is filled with values returned by functions inside table_with_functions.
Compiles fine, generates the following code:
return function(arg1, arg2)
do
local _with_0 = table_with_functions
return {
_with_0.fn1("work"),
_with_0.fn2("more work")
}
return _with_0
end
end
That last return is not valid Lua and it doesn't work.
I've ended up writing it like such:
(arg1, arg2) ->
with table_with_functions
return {
.fn1("work")
.fn2("more work")
}
local _
But that just seems like a hack to avoid implicit return.
Am I doing something wrong? Is there a better way? I've only been using MoonScript for about two days so I might've missed something.
Metadata
Metadata
Assignees
Labels
No labels