I need to read the contents of a tab but only part of it.
What I’d like to do is, on the tab to be read, put a special sequence behind a comment, maybe something like:
- - &$stophere#@
And only read the tab until there, or else read the whole tab and cut off everything after the special sequence.
Anyone know how I would do that?
@UberGoober No problem. I’ll whip something up.
@UberGoober Here it is. You can pick you own sequence and put it in the code. Right now I have —#* in the string find line. Enter the project and tab name then press find. It will print out the text up to the find sequence.
viewer.mode=STANDARD
function setup()
parameter.text("project")
parameter.text("tab")
parameter.action("find",search)
end
function search()
local temp=readProjectTab(project..":"..tab)
local pos=string.find(temp,"--#*",1,true)
if pos~=nil then
local str=string.sub(temp,1,pos-1)
print(str)
else
print("Not found")
end
end
@UberGoober This can also be updated to create a new tab with the found text.
That’s fantastic, thanks!