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

Error

Started by Cute Froggy :), 13 September 2016 - 08:48 AM
Cute Froggy :) #1
Posted 13 September 2016 - 10:48 AM
I'm really new and just made a simple program which is only 2 lines:

delete *
end

And this is what I get when I run it: bios.lua:14: [string ". temp"]:1: '=' expected
Edited on 15 September 2016 - 06:51 AM
Anavrins #2
Posted 13 September 2016 - 05:37 PM
The computercraft wiki has a neat tutorial on how to write Lua code, here http://www.computerc.../wiki/Tutorials
What you wrote is not Lua code.

If your intent was to run "delete *" as a shell command, then you must use a specific function, "shell.run"
So your code should look like

shell.run("delete *")
No end keyword needed.
Edited on 13 September 2016 - 03:45 PM
Cute Froggy :) #3
Posted 14 September 2016 - 08:24 AM
Thanks!
CCJJSax #4
Posted 14 September 2016 - 11:00 PM
Or you could use the fs API. fs.delete(path). Either one is one line of code.
Anavrins #5
Posted 15 September 2016 - 02:20 AM
fs.delete does not support the "*" wildcard, you'd have to make your own iterator that goes thru all of your files.