Emile Posted October 12, 2014 Share Posted October 12, 2014 Hello, I'm scripting a bus driver job and I have a location table. local stops = { {1825.586, -1827.725, 12.414}, {1976.795, -1756.753, 12.383}, ... } and I want to make it so when the player hits the marker, it gets the next location/row. I tried with for i,v in ipairs(stops) do local x,y,z = v[i+1] but it doesnt work. Thanks Link to comment
DNL291 Posted October 12, 2014 Share Posted October 12, 2014 Use a variable with the value of the first table index and increase it (+ 1) when the player hits the marker. And use that variable to get the next location, like: local x, y, z = unpack(stops[currentIndex]) 'currentIndex' must have the index which is the value of the next location. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now