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
[LUA][Help]clearPrint fuction
Started by remiX, Oct 10 2012 07:36 PM
5 replies to this topic
#1
Posted 10 October 2012 - 07: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 ._.
#2
Posted 10 October 2012 - 07: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...
#3
Posted 10 October 2012 - 07:54 PM
only around "w" and "p". o is a variable
#4
Posted 10 October 2012 - 07:55 PM
ya, didn't fully look at the code
/>
#5
Posted 10 October 2012 - 08:07 PM
DERP Can't believe I forgot about that, damn.
Now when I use it it clears the string that I have written.
It wouldn't show anything because for something it clears the string? O_o
Doing this works, but I want the argument to have just 'w' or 'p' not the full words
/> Why?
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
#6
Posted 10 October 2012 - 10:12 PM
Try passing it "p" instead of p.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











