I'm trying to make an analog clock display the time (12-hour) and I have to use Lua. I use the following line to get the time in this format:
os.date('%I:%M')
This apparently doesn't work as I keep getting a nil error, this is the only thing wrong with the code. os.time works fine but not os.date; I even tried without the '%I:%M' (The format for the time) and it still doesn't work with os.date().
What am I doing wrong? Do I have to import the date function from some other library? I am a total Lua nooby BTW...
I'm actually using it to work monitors for ComputerCraft on Minecraft but the code is:
m = peripheral.wrap('back')
m.setTextScale(5)
while i == i do
m.clear()
m.setCursorPos(1,1)
x = os.date('%I:%M')
m.write(x)
sleep(60)
end
The thing is though that the rest of the code doesn't affect it. The os.date is the only problem because I try it seperately and it gives me the same error "attempt to call nil".