-
Notifications
You must be signed in to change notification settings - Fork 0
/
mission.ks
executable file
·47 lines (47 loc) · 1 KB
/
mission.ks
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
44
45
46
47
{
local f is "1:/runmode.ks".
local df is "1:/datafile.json".
export(
{
parameter d.
local r is 0.
if exists(f)
set r to import("runmode.ks").
local s is list().
local e is lex().
local v is lex().
if exists(df) {
local nv is readjson(df).
v:clear().
for t in nv:keys
v:add(t, nv[t]).
}
local n is {
parameter m is r+1.
if not exists(f)
create(f).
local h is open(f).
h:clear().
h:write("export("+m+").").
writejson(v, df).
set r to m.
}.
d(s,e,v,n).
return {
until r>=s:length {
if exists(df) {
local nv is readjson(df).
v:clear().
for t in nv:keys
v:add(t, nv[t]).
}
s[r]().
writejson(v, df).
for t in e:values
t().
wait 0.
}
}.
}
).
}