Help is appreciated!
Thanks!
Also, sorry if I have bad English.
Edited by grand_mind1, 19 January 2013 - 05:56 PM.
Posted 19 January 2013 - 05:54 PM
Edited by grand_mind1, 19 January 2013 - 05:56 PM.
Posted 19 January 2013 - 06:24 PM
local file = fs.open( filePath, "r" ) local contents = file:readAll() file:close()
local file = fs.open( filePath, "w+" ) file:write( data ) file:close()
Edited by TheOriginalBIT, 19 January 2013 - 06:27 PM.
Posted 19 January 2013 - 08:22 PM
TheOriginalBIT, on 19 January 2013 - 06:24 PM, said:
local file = fs.open( filePath, "r" ) local contents = file:readAll() file:close()
local file = fs.open( filePath, "w+" ) file:write( data ) file:close()
Posted 19 January 2013 - 08:27 PM
grand_mind1, on 19 January 2013 - 08:22 PM, said:
Posted 19 January 2013 - 11:20 PM
TheOriginalBIT, on 19 January 2013 - 08:27 PM, said:
grand_mind1, on 19 January 2013 - 08:22 PM, said:
Posted 19 January 2013 - 11:36 PM
Posted 19 January 2013 - 11:43 PM
crazyguymgd, on 19 January 2013 - 11:36 PM, said:
Posted 19 January 2013 - 11:47 PM
TheOriginalBIT, on 19 January 2013 - 11:43 PM, said:
crazyguymgd, on 19 January 2013 - 11:36 PM, said:
Posted 19 January 2013 - 11:50 PM
crazyguymgd, on 19 January 2013 - 11:47 PM, said:
Posted 19 January 2013 - 11:55 PM
Posted 20 January 2013 - 12:21 AM
crazyguymgd, on 19 January 2013 - 11:55 PM, said:
Posted 20 January 2013 - 07:22 AM
local file = fs.open("test3","r") local contents = file:readAll() print(contents)like you showed me, I just added the 'print' part. Although I still don't know how to do things like check variables inside the file like I wanted it to. If I have owner = "me" on a disk and I want to check who the owner is using the code above, how would I go about doing this?
Posted 20 January 2013 - 07:25 AM
local file = fs.open("test3","r") local contents = file:readAll() print(contents) if contents == "owner" then print("Access granted!") -- you can edit "owner" else print("Wrong owner name!") endThis you want ?
Posted 20 January 2013 - 07:33 AM
owner = "Alex"And I have exactly what you wrote on my reading script.
Posted 20 January 2013 - 07:41 AM
local file = fs.open("test3","r") local contents = file:readAll() print(contents) if contents == "owner = \"Alex\"" then print("Access granted!") else print("Wrong owner name!") print("Shutting down computer in 3 seconds...") sleep(3) os.shutdown() end
Posted 20 January 2013 - 07:57 AM
Posted 20 January 2013 - 08:14 AM
serverId = --add here server id for example 61 local file = fs.open("card.info","r") if not fs.exists("card.info") then print("Error: Card: file card.info not exists") end local contents = file:readAll() rednet.send(serverId, contents) sleep(5) id, message = rednet.recive() if id == nil and message == nil then print("Server not responding. Please contact with administrator!") elseif id == serverId and message == nil then print("You aren't in the database of the server!") elseif id == serverId then user, balance = message print("Welcome "..user.."!") print("Your account balance: "..balance) end
Clients = {"X","X", "X"} -- replace X to the id of the clients computers while true do id, message = rednet.recive() if id == Clients then -- i don't know what to do now :X
Posted 20 January 2013 - 08:29 AM
Posted 20 January 2013 - 08:32 AM
local serverId = --server id local ci = fs.open("card.info","r") local contents = file:readAll() print(contents) if contents == "owner = \"Alex\"" then rednet.send(serverId, "Alex") end
0 members, 2 guests, 0 anonymous users