Get shop log: Difference between revisions
Jump to navigation
Jump to search
imported>Ereinion Created page with "{{ #vardefine:name|get_shop_log}}{{ #vardefine:return_type|int [item]}}{{ #vardefine:aggregate|yes}}{{ FunctionPage| name={{#var:name}}| function1={{Function| name={{#var:na..." |
imported>AlbinoRhino mNo edit summary |
||
Line 1: | Line 1: | ||
{{ | {{ | ||
#vardefine:name|get_shop_log}}{{ | #vardefine:name|get_shop_log}}{{ | ||
#vardefine:return_type|int | #vardefine:return_type|string [int]}}{{ | ||
#vardefine:aggregate|yes}}{{ | #vardefine:aggregate|yes}}{{ | ||
Revision as of 07:06, 27 December 2017
Function Syntax
string [int] get_shop_log()
Returns a map of transactions in your store, keyed by the line number each is found on in your store log
Code Sample
The following will print all lines in the shop log where the transaction amount was larger than 500,000 meat
void write_big_sales(int limit) {
string[int] shopLog = get_shop_log();
matcher meat_gain;
string pattern = "for (\\d+) Meat";
int meat;
foreach i in shopLog {
meat_gain = create_matcher(pattern, shopLog[i]);
if (find(meat_gain)) {
meat = to_int(group(meat_gain, 1));
if (meat >= limit) {
print_html("<font color=0000FF>" + i + " - " + shopLog[i] + "</font>");
}
}
}
}
void main() {
write_big_sales(500000);
}
See Also
[[Category:]]