Re: Searching .txt files and print to drop down. Even possible?
Posted: Sun Dec 26, 2021 7:44 pm
Not sure if this is the best way or not.. but i managed to get it working with this:
It seems to be pulling all the address's now and not giving any error... Do you see anything i might of done wrong that im not seeing?
Code: Select all
local dropDownData = { }
for address, name in fileStr:gmatch('%[%x-%]%s(%x-)%sItemPoolData%s.-([%w_]*%.[%w_]*)') do
if wanted[name] then
local prettyName = name:match('^[%w_]-%.ItemPool_(.-)$')
---- this will make the names look like this: "BigBoomBlaster", "Pills Downer"
---- But you can just use name if this doesn't match enough.
---- Here we setup a table to call concat on.
if prettyName then
table.insert(dropDownData, address..':'..prettyName:gsub('_', ' '))
else
prettyName = name:match('^[%w_]-%.DA_ItemPool_(.-)$')
if prettyName then
table.insert(dropDownData, address..':'..prettyName:gsub('_', ' '))
else
prettyName = name:match('^[%w_]-%.Itempool_(.-)$')
if prettyName then
table.insert(dropDownData, address..':'..prettyName:gsub('_', ' '))
else
table.insert(dropDownData, address..':'..name)
end
end
end
end
end