2088 posts
Location
South Africa
Posted 10 October 2012 - 08:36 PM
I'm trying to make an argument for my clearPrint fuction, so if you type p in the place of o it will print the string, or if you type w it will write the string. But I can't get it to work. It use to clear the screen but all of a sudden it doesn't anymore ._.
function clearPrint(string, o, x, y)
if not x or x < 0 then x = 1 end
if not y or y < 0 then y = 1 end
term.clear()
term.setCursorPos(x,y)
if o == w then
write(string)
elseif o == p then
print(string)
end
end
116 posts
Location
At my Computer coding for the Computer in my Computer
Posted 10 October 2012 - 08:46 PM
put quotes around the the "w", the "o", and the "p", so it knows its a string, if I understand what you mean…
818 posts
Posted 10 October 2012 - 08:54 PM
only around "w" and "p". o is a variable
116 posts
Location
At my Computer coding for the Computer in my Computer
Posted 10 October 2012 - 08:55 PM
ya, didn't fully look at the code :P/>/>
2088 posts
Location
South Africa
Posted 10 October 2012 - 09:07 PM
DERP Can't believe I forgot about that, damn.
function clearPrint(string, o, x, y)
if not x or x < 0 then x = 1 end
if not y or y < 0 then y = 1 end
term.clear()
term.setCursorPos(x,y)
if o == "w" then
write(string)
elseif o == "p" then
print(string)
end
end
Now when I use it it clears the string that I have written.
clearPrint("derp", p)
It wouldn't show anything because for something it clears the string? O_o
function clearPrint(s, o, x, y)
if not x or x < 0 then x = 1 end
if not y or y < 0 then y = 1 end
term.clear()
term.setCursorPos(x,y)
o(s)
end
Doing this works, but I want the argument to have just 'w' or 'p' not the full words :P/>/> Why?
8543 posts
Posted 10 October 2012 - 11:12 PM
Try passing it "p" instead of p.