Shell.run requests curly brackets for no reason
mopishlynx23 opened this issue ยท 2 comments
I was working on a file that saves all necessary files to a floppy disk when shell.run randomly requested an open curly bracket.
os.loadAPI("utils")
local a = utils.checkPeripherals()
for side, peripheral in pairs(a) do
if peripheral == "drive" then
shell.run("delete", "drive\menu")
shell.run("delete", "drive\startup")
shell.run("delete", "drive\utils") -- "missing '{' near '"drive\ut'" ???
shell.run("delete", "drive\button")
shell.run("delete", "drive\dropDown")
shell.run("copy", "menu", "drive")
shell.run("copy", "startup", "drive")
shell.run("copy", "utils", "drive")
shell.run("copy", "button", "drive")
shell.run("copy", "dropDown", "drive")
end
end
I see absolutely no reason for this to happen, and it only happens for utils for whatever reason. I understand there's probably a much simpler solution than calling the delete and copy programs but I didn't think it'd matter. I'm really confused.
This isn't anything to do with the nhell, but just Lua in general. Backslashes are parsed as escape characters. For instance, \n
is considered a new line. In this case, \u
is the start of a Unicode escape sequence.
You don't want this - replace your backslashes with forward ones and it should work.