diff options
| author | heav <hheav3@gmail.com> | 2022-12-27 20:42:05 +0000 |
|---|---|---|
| committer | heav <hheav3@gmail.com> | 2022-12-27 20:42:05 +0000 |
| commit | 56ac8a22bb1d2859c478295c6f52e2dbd1a6680c (patch) | |
| tree | e58ba42a39749ed9e506ac7d5cef84db0b2e4042 /obj.lua | |
| parent | c15af7b16c64d0e44393ca30157fc24ded42b310 (diff) | |
added obj.total_energy().
Diffstat (limited to 'obj.lua')
| -rw-r--r-- | obj.lua | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -74,6 +74,14 @@ function obj.all() end) end +function obj.total_energy() + local res = 0 + for obj in obj.all() do + res = res + obj:energy() + end + return res +end + function obj:__index(v) if obj[v] then return obj[v] |
