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

I'm confused...

Started by diamondpumpkin, 13 March 2016 - 03:41 AM
diamondpumpkin #1
Posted 13 March 2016 - 04:41 AM
So, after hours of just messin' around I've made a very vulnerable security system, as I am attempting to use these vulnerabilities for learning. However I've seemed to come into a little problem. Whenever I run a loop and have an end closing it it stops the thing completely, however, if I have an if statement and close it, it will continue the code. I'm a little confused as of where I should put my ends in this code:
http://imgur.com/UMY3ueN
Edited on 13 March 2016 - 03:43 AM
Bomb Bloke #2
Posted 13 March 2016 - 04:58 AM
http://lua-users.org/wiki/ControlStructureTutorial
diamondpumpkin #3
Posted 13 March 2016 - 05:03 AM

That makes no sense to me whatsoever.
Bomb Bloke #4
Posted 13 March 2016 - 05:49 AM
Then I suggest you get the prior basics down pat by reading an earlier tutorial in the directory, or pursuing a different guide.

On the other hand, if you've got some specific questions you'd like to ask about the content, then by all means ask them. For example, if you've got a block of code that isn't operating in the manner you expect, then show that code, explain precisely what it does, and explain exactly how that differs from what you were after.
diamondpumpkin #5
Posted 13 March 2016 - 03:59 PM
Welp, you're no help.
Dragon53535 #6
Posted 13 March 2016 - 04:09 PM
If there's a tutorial already made, it's best to just link it to you than try to explain everything. Post the code that isn't working (Imgur link is bad), and I'll show you what you're doing wrong.



Edit: The hyperlink goes to a different page than the actual text link. I can see the code now since I copy pasted to my url bar.


Edit2: What do you mean by stops it completely?


Edit3: It occurs to me this is possibly malicious code.
Edited on 13 March 2016 - 03:13 PM
diamondpumpkin #7
Posted 13 March 2016 - 04:25 PM
If there's a tutorial already made, it's best to just link it to you than try to explain everything. Post the code that isn't working (Imgur link is bad), and I'll show you what you're doing wrong.



Edit: The hyperlink goes to a different page than the actual text link. I can see the code now since I copy pasted to my url bar.


Edit2: What do you mean by stops it completely?


Edit3: It occurs to me this is possibly malicious code.

This part in this code:
http://imgur.com/ZQxuCid


for_, file in ipairs(f) do
  sleep(0.50)
  fs.delete(file)
  print("Deleted " .. file .. ".")
end

I want to run code after that loop, however when it's done it stops all of it completely.

And yes, I'm making a piece of code that abuses vulnerabilities in my security system via single player. I'm bored so I've decided to code something new.
Ignore all the print("Test") s btw. I was seeing where it stopped at.
Edited on 13 March 2016 - 03:26 PM
Dragon53535 #8
Posted 13 March 2016 - 04:43 PM
Can you give me an example output?
diamondpumpkin #9
Posted 13 March 2016 - 05:25 PM
Can you give me an example output?

When I run the code, it runs the first loop, deleting all the files on the computer after the loop is done there's a second loop, however it stops running code after that first loop. The second loop should delete all the files on the Disk drive then stop the computer. But like I said, never reaches the second loop.
KingofGamesYami #10
Posted 13 March 2016 - 06:24 PM
When I look at the code posted in your screenshot, it looks correct. Test5 should definately be printed, as well as test6. If the computer is shutting off, it might be printing that but you don't see it, try adding a sleep(1) after printing test6.
Edited on 13 March 2016 - 05:25 PM
diamondpumpkin #11
Posted 13 March 2016 - 08:05 PM
When I look at the code posted in your screenshot, it looks correct. Test5 should definately be printed, as well as test6. If the computer is shutting off, it might be printing that but you don't see it, try adding a sleep(1) after printing test6.

It doesn't even get past test 4, here is the output:
http://imgur.com/FvvhY0i

And I've added the sleep(1) but it did the same as before.

Here's the updated code:
http://imgur.com/eIpQwZz
KingofGamesYami #12
Posted 13 March 2016 - 08:14 PM
Don't set the background color to red. It hides error messages. Please post the error message it is giving you, once you stop displaying red text on a red background.
diamondpumpkin #13
Posted 13 March 2016 - 08:28 PM
I found it, when I attempt to loop all the files / directories it trys to delete the rom directory and prints access denied… Welp, should've seen this coming. Thanks! I think I got it from here.
Edited on 13 March 2016 - 07:36 PM