My object getting isnt working
In my game I have to do something like this but I keep getting an error for example for this one it's "Warning: one,two is not defined, defaulting to zero, in file "main" at line 10, column 11"
This is my code
init = function()
obj = object
one = "apple"
two = "pear"
end
end
update = function()
local objj = ["one","two"]
print(obj[objj])
end
draw = function()
end
this is because you are trying to find a list in the object containing those but there aren't any lists in the obj so its looking for [list] but you need to iterate through each item in the list then see if the obj contains that specific item
init = function()
obj = object
one = "apple"
two = "pear"
end
done = 0
end
update = function()
if done == 0 then
done = 1
local objj = ["one", "two"]
for key in objj
print(obj[key])
end
end
end
draw = function()
end