qb-core icon indicating copy to clipboard operation
qb-core copied to clipboard

feat: Add Filter to QBCore export

Open Jamie9192 opened this issue 1 year ago • 4 comments

Pass the structure of QBCore, making the value you want equal either "all" or true. Examples in main.lua on client and server side

Description

Adds ability to filter the core object when importing. Thus reducing memory usage. Fixes: importing large object of unneccessary data when not required

Checklist

  • [ X] I have personally loaded this code into an updated qbcore project and checked all of its functionality.
  • [X ] My code fits the style guidelines.
  • [X ] My PR fits the contribution guidelines.

Jamie9192 avatar Jul 09 '24 21:07 Jamie9192

image_2024-07-11_105110109

Testing shows major improvement only importing Functions. Shared seems to be the main cause of large object. This being client side testing only.

For reference: a localised empty table uses 255KiB I pasted wrong one for shared vehicles - it was alot lower

Jamie9192 avatar Jul 11 '24 09:07 Jamie9192

@Jamie9192 Could you just add the code to the export with an early return of the full core object if no filters

GhzGarage avatar Jul 11 '24 15:07 GhzGarage

@Jamie9192 Could you just add the code to the export with an early return of the full core object if no filters

Sure, but the filter function is not just for the core object, and could potentially be used in other resources

Jamie9192 avatar Jul 11 '24 18:07 Jamie9192

The only thing i would maybe like to see, is the filter function itself being moved to QBShared, as maybe a: QBShared.FilterTable

This would make sense more so if the core exports were shared, but they are separated, and Shared holds data rather than functions.

As it is a function, I believe its best to be added as such

Jamie9192 avatar Jul 13 '24 18:07 Jamie9192

This PR has had 60 days of inactivity & will close within 7 days

github-actions[bot] avatar Sep 12 '24 15:09 github-actions[bot]