This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
william3080's profile picture

Superclock :8: attempt to index ? (a nil value)

Started by william3080, 27 May 2013 - 09:03 AM
william3080 #1
Posted 27 May 2013 - 11:03 AM
Hmm…


local mon = peripheral.wrap("side")
function round(num, idp)
local mult = 10^ (idp or 0)
return math.floor(num * mult +0.5) / mult
end
function loop ()
while true do
mon.clear()
mon.setCursorPos (1,1)
mon.setTextScale (3)
z = os.time ()
if z < 12 then
y = z
a = y%1
h = y - a
b = a * 60
m = round( B)/>
if m >= 10 then
min = m
elseif m < 10 then
min = "0"..m
end
if h < 1 then
hour = 12
elseif h >= 1 then
hour = h
end
x = hour.. ":"..min.." AM"
elseif z > 12 then
y = z - 12
a = y%1
h = y - a
b = a * 60
m = round( B)/>
if m >= 10 then
min = m
elseif m < 10 then
min = "0"..m
end
if h < 1 then
hour = 12
elseif h >= 1 then
hour = h
end
x = hour..":"..min.." PM"
end
mon.write(x)
sleep(1)
end
end
loop()

Trying to make clock

Having lots of issues, tried to fix some, probably just messed up more… so, it says:

Superclock :8: attempt to index ?
(a nil value)
Any help? Just want a clock that isn't tangent, but I guess I'd go with that one if need be… I've seen much better, though… thanks.
Edited by
Lyqyd #2
Posted 27 May 2013 - 02:33 PM
Split into new topic.

You have to actually replace "side" with the side that the monitor is on, like "left" or "back".
nutcase84 #3
Posted 27 May 2013 - 03:03 PM
Yep, Lyqyd is right. And if your not that good, I suggest using the monitor program to simplify things. You can call it in a program like this:

shell.run("monitor", <Monitor Side>,  <Program Name>)
Hope this helps.