Hello,
I know there are many posts about this, but I don't understand a single word, so I hope someone can explain me some stuff.
I want a program to check if in the startup file exists a line with "shell.run". (Anything can be behind it)
How is that possible?
Splitting Strings
Started by svdragster, Jan 30 2013 08:04 AM
7 replies to this topic
#1
Posted 30 January 2013 - 08:04 AM
#2
Posted 30 January 2013 - 08:12 AM
You would do something like this:
local f = io.open("/startup", "r") -- open the startup file for reading
local data = f:read("*a") -- read the entire file
f:close() -- close the file
if data:find("shell.run") then -- check if "shell.run" exists in the file contents.
print("Found a line with shell.run!")
end
#3
Posted 30 January 2013 - 08:17 AM
Thanks ~_~
#4
Posted 30 January 2013 - 08:17 AM
Btw, it has nothing to do with splitting strings
#5
Posted 30 January 2013 - 08:19 AM
xD Fail, well that's the only thing I found while searching for something like this...
#6
Posted 30 January 2013 - 08:20 AM
IIRC, :find() uses pattern matching, so you should probably escape that dot when looking for shell.run.
if data:find("shell%.run") then
#7
Posted 30 January 2013 - 08:27 AM
Would be
if data:find("shell\.run") then
3 user(s) are reading this topic
0 members, 3 guests, 0 anonymous users












