2024-01-31 15:18:25 +00:00
|
|
|
raw_data = fs:read_file('examples/assets/seaCreatures.json')
|
2024-01-01 12:46:47 +00:00
|
|
|
sea_creatures = json:parse(raw_data)
|
2023-10-23 20:12:43 +00:00
|
|
|
|
|
|
|
data = {
|
|
|
|
creatures = []
|
|
|
|
total_clams = 0
|
|
|
|
dolphin_clams = 0
|
|
|
|
}
|
|
|
|
|
|
|
|
for creature in sea_creatures {
|
2023-11-15 01:00:57 +00:00
|
|
|
data:creatures += creature:name
|
|
|
|
data:total_clams += creature:clams
|
2023-10-23 21:36:11 +00:00
|
|
|
|
2023-11-15 01:00:57 +00:00
|
|
|
if creature:type == 'dolphin' {
|
|
|
|
data:dolphin_clams += creature:clams
|
2023-10-23 20:12:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
data
|