Posted 24 March 2016 - 10:05 PM
Hi,
I have this error when I try to use a table with the Color API :
bios:14: [string "elevator"]:2: '}' expected
but I can't understand why
here is my code :
thanks for your help
I have this error when I try to use a table with the Color API :
bios:14: [string "elevator"]:2: '}' expected
but I can't understand why
here is my code :
------ VARS ------
local maxFloor = 1
local tableFloor = {0 = colors.yellow, 1 = colors.orange}
------ FUNCTIONS ------
function getCurrentFloor()
for Floor, value in pairs(tableFloor) do
if redstone.testBundledInput("back", value) == true then
return Floor
end
end
return -1
end
function stop()
redstone.setBundledOutput("left", 0)
end
function down()
redstone.setBundledOutput("left", colors.yellow)
sleep(0.5)
stop()
end
function up()
redstone.setBundledOutput("left", colors.orange)
sleep(0.5)
stop()
end
function goFloor(Floor)
if Floor > maxFloor then
Floor = maxFloor
end
print("Go to floor "..Floor)
while getCurrentFloor() ~= Floor do
if Floor < getCurrentFloor() then
down()
elseif Floor > getCurrentFloor() then
up()
end
sleep(1)
if getCurrentFloor() == -1 then
print("ERROR")
return
end
end
print("Arrived at floor "..Floor)
end
------ MAIN ------
while true do
goFloor(1)
sleep(5)
goFloor(0)
sleep(5)
end
thanks for your help