Hello,
I don’t understand hashes. I know what a hash is (a number got by applying a function on a string).
But when reading this in the documentation, for go.get_position(id)
[id]
string | hash | url optional id of the game object instance to get the position for, by default the instance of the calling script
I understand i can give as a parameter the name of my game object, it’s hashed value or the path to it (the url).
Still doing the runner tutorial, i’ve tried this:
local pieces = { "ground00", "ground01", "ground02", "ground03",
"ground04", "ground05", "ground06" }
function init(self)
self.speed = 6
for i, p in ipairs(pieces) do
pieces[i] = hash(p)
end
end
For replacing the string by its hash, at the beginning.
But when i try to get the position later, i have an error :
function update(self, dt)
for i, p in ipairs(pieces) do
local pos = go.get_position(p)
…
I get an error on the line which set the pos
variable: instance (null) not found
.
May be a bug on my side ? Or i don’t understand how to use hashed values.
Thank you for reading.