I started learning Lua around 2 days ago so please understand I'm far from a pro xD thus why I'm here. I need to understand the new-line "/n" in monitors I have searched alot and found some interesting answers but none simple as I would like.
Posts about monitors and the coding are few and far between so trying to get the info i need is tough but not impossable. I have created a simple code to check if there is a peripheral on the right and print a message to confirm and also to check what kind of peripheral it is and to report if it is indeed a monitor.
incoming nub-cake coding:
---[[ local w,h = term.getSize() local wm, hm, monitor local monP = peripheral.isPresent("right") local monT = peripheral.getType("right") --]] ---[[ function startMonitor() monitor = peripheral.wrap("right") monitor.setTextScale(1) wm, hm = monitor.getSize() monitor.clear() end startMonitor() --]] ---[[ if monP == true then print("The monitor on the right is present") else print("No monitor on the right detected") end if monT == "monitor" then print("This is a monitor") else print("I don't know what the peripheral is") end --]] ---[[ if monP == true then monitor.write("The monitor on the right is present") else monitor.write("No monitor on the right detected") end if monT == "monitor" then monitor.write("This is a monitor") else monitor.write("I don't know what the peripheral is") end --]]
As you can see I called a few local variables and setup the monitor function, and yes I have tried to change the last part of the code to have the new-line but it does nothing but show a ?.
new-line coding:
---[[ if monP == true then monitor.write("The monitor on the right is presentn") else monitor.write("No monitor on the right detectedn") end if monT == "monitor" then monitor.write("This is a monitorn") else monitor.write("I don't know what the peripheral isn") end --]]
I'm guessing that maybe i need to set a variable in the header for it to understand n? maybe I'm just being the plank that I am and missing something?
I know you can use term.redirect() but that doesn't seem to be without it's issues at the moment (or at least for me it doesn't) so I would like to try and keep it clean and to set it to functions that I can call later within the program.
Any help would be great!
Edit: changed the /n to n.. what a plank lol xD