24.11.2020, 09:56
There were some errors in the script, this should work:
Code:
<?
require('apps')
setdlheader('text/csv; charset=utf-8', 'Consumption', 'csv')
csv = {}
objects = grp.tag('consumption')
for _, obj in ipairs(objects) do
csv[ #csv + 1 ] = obj.name .. ',' .. tostring(obj.value)
end
print(table.concat(csv, '\n'))