220 posts
Location
Germany
Posted 01 May 2013 - 03:02 PM
function input()
term.setBackgroundColour( colors.lightGray )
clear(2, 18, 1, 51) -- clear(fromline, toline, fromcolumn, tocolumn)
term.setTextColour( colors.yellow )
term.setCursorPos(2,2)
write("Input needed: ")
term.setTextColour( colors.orange )
inputtxt = read()
return inputtxt
end
input()
os.run({}, "/SVOS/paint", inputtxt) -- The simple paint, just copied to a different dir
paint:40:attempt to index? (nil value)I need os.run() or it will overwrite some functions like fs.open() I changed in the startup file for some safety.
992 posts
Posted 01 May 2013 - 03:12 PM
use
shell.run("/SVOS/paint", inputtxt)
770 posts
Location
In My Lonely Little Computer Corner
Posted 01 May 2013 - 03:16 PM
Why do you return inputtxt if it's a global variable?
Try what BigSHinyToys said.
992 posts
Posted 01 May 2013 - 03:24 PM
paint is a shell dependent program it requires shell.resolve witch is a pain we can work around this problem thought
function input()
term.setBackgroundColour( colors.lightGray )
--clear(2, 18, 1, 51) -- clear(fromline, toline, fromcolumn, tocolumn)
term.setTextColour( colors.yellow )
term.setCursorPos(2,2)
write("Input needed: ")
term.setTextColour( colors.orange )
inputtxt = read()
return inputtxt
end
input()
local tEnv = {
shell = {
resolve = function(...)
local tArg = {...}
return unpack(tArg)
end,
}
}
setmetatable(tEnv,{__index = _G})
os.run(tEnv,"rom/programs/color/paint", inputtxt)
220 posts
Location
Germany
Posted 01 May 2013 - 03:26 PM
I've overwritten the fs api, which will be set back to normal when using shell.run(). Any other way except shell.run() or dat pain?
Why do you return inputtxt if it's a global variable?
Didn't work before, so I was trying this and it worked. Or I was an idiot, could be possible, too.
992 posts
Posted 01 May 2013 - 03:32 PM
I've overwritten the fs api, which will be set back to normal when using shell.run(). Any other way except shell.run() or dat pain?
Why do you return inputtxt if it's a global variable?
Didn't work before, so I was trying this and it worked. Or I was an idiot, could be possible, too.
I don't think shell.run resets fs have you tested weather it will or not ??
220 posts
Location
Germany
Posted 01 May 2013 - 03:40 PM
Oh well, sometimes it does… Scary :o/>
When changing io to fs in paint on line 120 it works with shell.run().
Before, when running things with shell.run it has overwritten the function.
Thanks for the help :P/>