Lachee / Lachee/fivem-busdriver

table remove inside for loop

Open
#2 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
19
Forks
6
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in client/entities/Bus.lua at lines 135-180 and inspect the two functions that call table.remove inside a loop. Verify how deletion affects iteration and confirm that the intended entries are all processed without being skipped.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
game-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.