Posted 01 November 2014 - 08:03 PM
I'm getting the error
"multiple points"
when running my program. I know this means it's a number with more than one decimal point, but I can't figure out where.
Here's my code:
Any ideas?
"multiple points"
when running my program. I know this means it's a number with more than one decimal point, but I can't figure out where.
Here's my code:
print("b1")
world = {}
world.myx = 0
world.myy = 0
world.mydir = "+y"
function mysplit(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={} ; i=1
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
t[i] = str
i = i + 1
end
return t
end
print("b2")
function world.turnleft()
print("b3")
turtle.turnLeft()
if world.mydir == "+y" then
world.mydir = "+x"
elseif world.mydir == "-y" then
world.mydir = "-x"
elseif world.mydir == "+x" then
world.mydir = "-y"
elseif world.mydir == "-x" then
world.mydir = "+y"
end
print("facing "..world.mydir)
end
function world.update()
print("world.update()")
local icur = world.myx..","..world.myy
print("current relative position: "..icur)
world[icur] = {}
world[icur].isSolid = false
world[icur].visited = true
if world.mydir == "+y" then
local ifront = world.myx..","..world.myy+1
elseif world.mydir == "-y" then
local ifront = world.myx..","..world.myy-1
elseif world.mydir == "+x" then
local ifront = world.myx+1..","..world.myy
elseif world.mydir == "-x"
local ifront = world.myx-1..","..world.myy
end
print("b3.5")
world[ifront] = {}
if turtle.detect() then
world[ifront].isSolid = true
else
world[ifront].isSolid = false
end
world[ifront].visited = false
if world.mydir == "+y" then
local iback = world.myx..","..world.myy-1
elseif world.mydir == "-y" then
local iback = world.myx..","..world.myy+1
elseif world.mydir == "+x" then
local iback = world.myx-1..","..world.myy
elseif world.mydir == "-x" then
local iback = world.myx+1..","..world.myy
end
world.turnleft()
world.turnleft()
if turtle.detect() then
world[iback].isSolid = true
else
world[iback].isSolid = false
end
world.turnleft()
world.turnleft()
world[iback].visited = false
end
world.update()
print(unpack(world))
print("ok")
Any ideas?