And i want to find my file always, cuz this file will be changing locations
Thanks in advance.
Posted 27 July 2015 - 10:44 AM
Posted 27 July 2015 - 11:24 AM
shell.getRunningProgram ()for the file path, and
fs.getDir (shell.getRunningProgram ())for the directory.
Posted 27 July 2015 - 11:26 AM
local file = textutils.serialize( fs.find( "main.lua" ) )
if #file == 0 then
error( "Cannot find file...", 0 )
elseif #file == 1 then
print( "main.lua is located at: " .. file[ 1 ] )
elseif #file > 1 then
print( "main.lua is at multiple locations." )
print( "It could be at " .. file[ 1 ] )
for i = 2, #file do
print( "Or at " .. file[ i ] )
end
end
Posted 27 July 2015 - 11:48 AM
LewisTehMinerz, on 27 July 2015 - 11:26 AM, said:
local file = textutils.serialize( fs.find( "main.lua" ) ) if #file == 0 then error( "Cannot find file...", 0 ) elseif #file == 1 then print( "main.lua is located at: " .. file[ 1 ] ) elseif #file > 1 then print( "main.lua is at multiple locations." ) print( "It could be at " .. file[ 1 ] ) for i = 2, #file do print( "Or at " .. file[ i ] ) end end
Posted 27 July 2015 - 07:32 PM
0 members, 2 guests, 0 anonymous users