qbcore-framework / qb-core

FiveM RP Framework Core :muscle:
GNU General Public License v3.0
582 stars 962 forks source link

feat: Add Filter to QBCore export #1124

Closed Jamie9192 closed 1 week ago

Jamie9192 commented 2 months ago

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

Jamie9192 commented 2 months ago

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

GhzGarage commented 2 months ago

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

Jamie9192 commented 2 months ago

@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 commented 2 months ago

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

github-actions[bot] commented 2 weeks ago

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