Posted 12 October 2017 - 03:11 AM
i'm trying to load a file for my script program (will be shown in media once complete), but whenever i try to run it with a file, it just gives an error on line 10 or 11
pastebin: uwvtyEhR
pls help
Update: the bug was because i put quotes around a variable name
All fixed
lock the thread
pastebin: uwvtyEhR
local tArgs = { ... } --args
if #tArgs == 0 then --args
print('Usage: lsc <path>') --Print Usage
else
local path = tArgs[1] --path
local Scr = fs.open('path','r') --attempted fs access
local loop = true --loop
while loop do --loop begin
local commands = {} --empties commands
local line = Scr.readLine(1) --reads line
if line then --if the line has things
text = nil --nillifies text
for text in line:gmatch('%w+') --attempts to split text
do table.insert(commands,text) --more split
end--end split
for i=1,#commands do shell.run(commands[i]) --executes
end --end
else --else loop
loop = false --ends loop
end
end
end
i am a noob at lua.pls help
Update: the bug was because i put quotes around a variable name
All fixed
lock the thread
Edited on 12 October 2017 - 08:19 PM