Posted 31 August 2013 - 07:13 AM
Topic: Function returns to another function
Hello, I am working on something like the following:
when I call the function with a print I get the following:
print(getCords("x,z")) output: 51
seems okay but expected a space in between.
Now my problem is when I do function call inside another function
newy = 10
check = checkCords(getCords("x,z"),newy)
I print the parameters passed in and get: 5 10
Any assistance is greatly appreciated.
Hello, I am working on something like the following:
cords {x=5, y=1, z=1}
function getCords(cord)
--Returns x,y,z or if string specified just that cord
if type(cord) == "string" then string.lower(cord)
else cord = nil end
if cord == nil then
return cords.x, cords.y, cords.z
elseif cord == "x,z" then
return cords.x, cords.z
elseif cord == "x,y" then
return cords.x, cords.y
elseif cord == "y,z" then
return cords.y, cords.z
elseif cord == "x" then
return cords.x
elseif cord == "y" then
return cords.y
elseif cord == "z" then
return cords.z
end
end
when I call the function with a print I get the following:
print(getCords("x,z")) output: 51
seems okay but expected a space in between.
Now my problem is when I do function call inside another function
newy = 10
check = checkCords(getCords("x,z"),newy)
I print the parameters passed in and get: 5 10
Any assistance is greatly appreciated.