Nestharus
o-o
- Reaction score
- 84
You asked for an example of grep and clone
Here's a grep example. Clone is the exact same but without the filter ^_-
So yea, something like this being part of the language for generic data and typed data would be nice ; ). Typed wouldn't require a trigger evaluation. Grep could have any sort of filter and I don't control the data inside of the structs in any way, so it has to be a trigger evaluation here : ). This is actually similar to how a lot of AGL-T3 works in the background, except that AGL-T3 can do a lot more ;o.
Here's a grep example. Clone is the exact same but without the filter ^_-
JASS:
library Test initializer Initialization {
private struct MyList extends array {
int data
implement IterateList
}
trigger myFilter = CreateTrigger()
trigger mySet = CreateTrigger()
MyList myList1
MyList myList2
bool Filter() {
if MyList.filter.data >= 4 && MyList.filter.data <= 12 {
return true
}
return false
}
bool Clone() {
MyList.cloneList.data = MyList.filter.data
MyList.filter.remove() //just to show we can remove it if we wanted to
return false
}
void Initialization() {
TriggerAddCondition(myFilter, Condition(function Filter))
TriggerAddCondition(mySet, Condition(function Clone))
myList1 = MyList.create()
myList1.push.data = 13
myList1.push.data = 13
myList1.push.data = 9
myList1.push.data = 4
myList1.push.data = 12
myList1.push.data = 1042
myList1.push.data = 6
myList1.push.data = 4
myList1.push.data = 1042
myList1.push.data = 139
myList2 = myList1.grep(myFilter, mySet)
}
}
So yea, something like this being part of the language for generic data and typed data would be nice ; ). Typed wouldn't require a trigger evaluation. Grep could have any sort of filter and I don't control the data inside of the structs in any way, so it has to be a trigger evaluation here : ). This is actually similar to how a lot of AGL-T3 works in the background, except that AGL-T3 can do a lot more ;o.