Open jbhoot opened 2 months ago
In case it helps anyone else, I wrote the following function as an alternative that is applicable for my specific use-case:
function make_collection_path(collection_text)
-- collection_path = gsub(strlower(collection_text), " ", "-")
local char_idx = 1
local collection_path = ""
while char_idx <= strlen(collection_text) do
local currchar = strlower(strsub(collection_text, char_idx, char_idx))
if currchar == " " then
collection_path = collection_path .. "-"
else
collection_path = collection_path .. currchar
end
char_idx = char_idx + 1
end
return collection_path
end
I am still interested in knowing what happened to gsub
.
Ah. lua-ml does not implement it.
Was gsub
in PUC-Rio Lua 2.5?
You can use https://soupault.app/reference-manual/#Regex.replace_all
You can use https://soupault.app/reference-manual/#Regex.replace_all
Thank you!
Was gsub in PUC-Rio Lua 2.5?
Not sure about that. But its documented in the Lua 2.5 reference manual linked to in the soupault reference manual.
I want to convert the text of a tag element into a url path: Firefox add-on -> firefox-add-on.
Using the Lua 2.5 manual, I wrote this transformation:
collection_path = gsub(strlower(collection_text), " ", "-")
But, soupault gives an error:
of which the statement of import is:
Runtime error: string library does not implement gsub
But Lua 2.5 manual documents it.
Any clue on what's going on?