Hello, I’m a new user (one day old) and I’d like to get a function working in my pages.
Let me know if this is not the spot to post these questions!
I added the following function within a page, and tried to call it with ${transform_calorie_text(...)}, which didn’t really work (function is still nil). Am I supposed to do something more to make the function available? Do I have to declare this somewhere else?
function transform_calorie_text(text)
local result = {}
for line in text:gmatch("[^\r\n]+") do
local before, inside = line:match("^(.-)%((.-)%)$")
if before and inside then
inside = inside:gsub("c", "")
before = before:gsub("%s*$", "")
table.insert(result, before .. "\t=" .. inside)
end
end
return table.concat(result, "\n")
end

