#minecraft #computercraft wtf?
mon = peripheral.wrap("right")
mon.setBackgroundColor(colors.black)
mon.clear()
file = fs.open("template", "r")
lines = 1
templates = {}
while true do
line = file.readLine()
if line == nil then
break
end
templates[lines] = {}
templates[lines]["x"] = line
line = file.readLine()
templates[lines]["y"] = line
line = file.readLine()
color = line
print(templates[lines]["x"])
mon.setCursorPos(templates[lines]["x"], template[lines]["y"])
mon.setBackgroundColor(colors.red)
mon.write(" ")
lines = lines+1
end
i error na 23 "expected number, number"
w pliku template pierwsza linijka zawiera
mon = peripheral.wrap("right")
mon.setBackgroundColor(colors.black)
mon.clear()
file = fs.open("template", "r")
lines = 1
templates = {}
while true do
line = file.readLine()
if line == nil then
break
end
templates[lines] = {}
templates[lines]["x"] = line
line = file.readLine()
templates[lines]["y"] = line
line = file.readLine()
color = line
print(templates[lines]["x"])
mon.setCursorPos(templates[lines]["x"], template[lines]["y"])
mon.setBackgroundColor(colors.red)
mon.write(" ")
lines = lines+1
end
i error na 23 "expected number, number"
w pliku template pierwsza linijka zawiera
mon = peripheral.wrap("right")
mon.setBackgroundColor(colors.black)
mon.clear()
file = fs.open("template", "r")
lines = 1
templates = {}
while true do
line = file.readLine()
if line == nil then
break
end
templates[lines] = {}
templates[lines]["x"] = line
line = file.readLine()
templates[lines]["y"] = line
line = file.readLine()
color = line
print(templates[lines]["x"])
mon.setCursorPos(templates[lines]["x"], template[lines]["y"])
mon.setBackgroundColor(colors.red)
mon.write(" ")
lines = lines+1
end
i error na 23 "expected number, number"
w pliku template pierwsza linijka
Rozwiązałem problem!
Kiedy readLine() czyta linijkę zamienia wszystko na string, wystarczy użyć tonumber() i śmiga