-
What do you want to achieve? Keep it simple and clear!
I’m trying to make a function that searches a script for strings and then prints the string table -
What is the issue? Include screenshots / videos if possible!
An error occurs at:
local ind3 = string.find(tx, '[[', i)
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried putting "\"s but it showed an error instead of a warning
Here is the script so far (unfinished):
local function get(tx)
local i = 1
local occ = {}
for i = 1,1e6 do --"for i = 1, 1e6" do only for testing. Change to "while true do"
local ind = string.find(tx, "'", i)
local ind2 = string.find(tx, '"', i)
local ind3 = string.find(tx, '[[', i)
if ind or ind2 then
if ind then
table.insert(occ, 1, ind)
i = ind + 1
else
table.insert(occ, 1, ind2)
i = ind2 + 1
end
elseif ind3 then
local ind4 = string.find(tx, ']]', ind3)
if ind4 then
table.insert(occ, 1, {ind3,ind4})
i = ind3 + 1
end
else break end
end
print(occ)
end