BeamMP / BeamMP-Server

Server for the multiplayer mod BeamMP for BeamNG.drive
https://beammp.com
GNU Affero General Public License v3.0
116 stars 49 forks source link

Fix Lua assert error when adding values to tables (e.g. in event arguments) #318

Closed lionkor closed 1 month ago

lionkor commented 1 month ago

When adding elements to a table, the .add() function does not behave as expected in various cases, making it really shit and difficult to use. Instead, we keep our own index and just add one by one. It works, and it's easy to understand.

This may lead to indices which are nil, i.e. non-fully-sequential tables, but I can't be asked to worry about it because that shouldn't be an issue when we use .set() everywhere.