fivem-busdriver icon indicating copy to clipboard operation
fivem-busdriver copied to clipboard

table remove inside for loop

Open FROST-D opened this issue 3 years ago • 0 comments

hello, first of all excellent resource. I wanted to point out these 2 reported functions which probably does not work as intended,

https://github.com/Lachee/fivem-busdriver/blob/0a7e32d2525b767a1092935196d444d4a005ba25/client/entities/Bus.lua#L135-L180

you are using the table.remove inside a loop, but table.remove cause the elements in the table to be shifted immediately after deletion, so you are not looping every element in the table but skipping 1 after every remove.

FROST-D avatar Feb 08 '22 18:02 FROST-D