- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.lua
More file actions
Latest commit
43 lines (37 loc) · 936 Bytes
/
Copy pathutil.lua
File metadata and controls
43 lines (37 loc) · 936 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
33
34
35
36
37
38
39
40
41
42
43
-- util.lua
localutil= {}
localparser=require('parser')
functionutil.newEventHandler(parent, model)
localobj=parentorrequire('controllers.Default')
returnfunction(event, args)
ifobj[event] then
obj[event](model, args)
else
love.event.push(event, args)
end
end
end
functionutil.newParsedScript(rawScript)
localparsedCommands=parser.parse(rawScript)
ifnotparsedCommandsthen
returnnil
end
localparsed= {
commands=parsedCommands
}
parsed.current=parsed.commands.top
parsed.nextCommand=function()
localcommand=parsed.current
ifcommandthen
parsed.current=command.next
returncommand
else
returnnil
end
end
parsed.setCommand=function(command)
parsed.current=command
end
returnparsed
end
returnutil