moonscript
moonscript copied to clipboard
Parsing failure... ?
running = {}
Node = (tab) ->
state, started = {}, false
return (object) ->
local result
unless started
result = tab.start object, state if tab.start
started = true unless result == false
result = tab.run object, state unless result == false
if result != running
started = false
result = tab.finish object, state if result and tab.finish
return result
Fails to parse on line 7, and I don't believe there is an error in my syntax...
Failed to parse:
[7] >> unless started
I think you have some kind of Unicode character, probably a nowidth, stuck in there. Perhaps a prank by some colleagues? Anyways, I rewrote it:
running = {}
Node = (tab) ->
state, started = {}, false
return (object)->
local result
unless started
result = tab.start object, state if tab.start
started = true unless result == false
result = tab.run object, state unless result == false
if result != running
started = false
result = tab.finish object, state if result and tab.finish
return result