This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
LDShadowLord's profile picture

Finding a String

Started by LDShadowLord, 22 June 2014 - 09:39 PM
LDShadowLord #1
Posted 22 June 2014 - 11:39 PM
So, a somewhat ambiguous question here. I'm attempting to make a program that will insert code at a certain point in a file, the problem being that I have no idea how I would find the string.
I'd like to set it out somewhat like this.

--InsertHere	 <-Where I want to insert contents of another file.
<File Contents>
</File Contents>
I know how to pull the contents from another file and from the file i'm writing to, I just don't know how to find a specific string and write to that point.
Bomb Bloke #2
Posted 23 June 2014 - 12:09 AM
Take a look at the documentation for the string.find() and string.gsub() functions here.
Edited on 22 June 2014 - 10:09 PM