Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,45 @@
|
|||
;-----------------------------------------------------------
|
||||
Nested_templated_data(template, Payload){
|
||||
UsedP := [], UnusedP := [], UnusedI := []
|
||||
result := template.Clone()
|
||||
x := ArrMap(template, Payload, result, UsedP, UnusedI, [])
|
||||
for i, v in Payload
|
||||
if !UsedP[v]
|
||||
UnusedP.Push(v)
|
||||
return [x.1, x.2, UnusedP]
|
||||
}
|
||||
;-----------------------------------------------------------
|
||||
ArrMap(Template, Payload, result, UsedP, UnusedI, pth){
|
||||
for i, index in Template {
|
||||
if IsObject(index)
|
||||
pth.Push(i), Arrmap(index, Payload, result, UsedP, UnusedI, pth)
|
||||
else{
|
||||
pth.Push(i), ArrSetPath(result, pth, Payload[index])
|
||||
if Payload[index]
|
||||
UsedP[Payload[index]] := 1
|
||||
else
|
||||
UnusedI.Push(index)
|
||||
}
|
||||
pth.Pop()
|
||||
}
|
||||
return [result, UnusedI, UsedP]
|
||||
}
|
||||
;-----------------------------------------------------------
|
||||
ArrSetPath(Arr, pth, newVal){
|
||||
temp := []
|
||||
for k, v in pth{
|
||||
temp.push(v)
|
||||
if !IsObject(Arr[temp*])
|
||||
Arr[temp*] := []
|
||||
}
|
||||
return Arr[temp*] := newVal
|
||||
}
|
||||
;-----------------------------------------------------------
|
||||
objcopy(obj){
|
||||
nobj := obj.Clone()
|
||||
for k, v in nobj
|
||||
if IsObject(v)
|
||||
nobj[k] := objcopy(v)
|
||||
return nobj
|
||||
}
|
||||
;-----------------------------------------------------------
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
T := [[[1,2] , [3,4,1] , 5]]
|
||||
; Autohotkey uses 1-based objects/arrays
|
||||
P := ["Payload#1", "Payload#2", "Payload#3", "Payload#4", "Payload#5", "Payload#6", "Payload#7"]
|
||||
Results := Nested_templated_data(objcopy(t), P)
|
||||
output := Results.1
|
||||
Undefined_indices := Results[2]
|
||||
Unused_Payloads := Results[3]
|
||||
Loading…
Add table
Add a link
Reference in a new issue