-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib_raw_user_input.ks
54 lines (44 loc) · 1.05 KB
/
lib_raw_user_input.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
48
49
50
51
52
53
54
// This file is distributed under the terms of the MIT license, (c) the KSLib team
// Originally developed by abenkovskii
@LAZYGLOBAL OFF.
run lib_exec.
function wait_for_action_groups
{
parameter ag_list. // list of strings
function first_diff
{
parameter list_a.
parameter list_b.
local iter_a is list_a:iterator.
local iter_b is list_b:iterator.
until not (iter_a:next and iter_b:next)
{
if iter_a:value <> iter_b:value
{
break.
}
}
local result is iter_a:index.
if iter_a:atend and iter_b:atend
{
set result to -1.
}
return result.
}
local arg_string is "".
local separator is "".
for ag_name in ag_list
{
set arg_string to arg_string + separator + ag_name.
set separator to ", ".
}
lock _raw_input_ag_list to -1.
execute("lock _raw_input_ag_list to list(" + arg_string + ").").
local old_values is _raw_input_ag_list.
local result is -1.
until result <> -1
{
set result to first_diff(old_values, _raw_input_ag_list).
}
return result.
}