Skip to content

Conversation

@Cocodrulo
Copy link
Contributor

Description

This pull request introduces a new helper function to the shared codebase to simplify access to shared data. The main change is the addition of a generic GetShared function, making it easier and safer to retrieve shared data from various shared namespaces.

Helper function addition:

  • Added the GetShared function to shared/main.lua, allowing retrieval of shared data from specified shared namespaces with safe navigation.

Checklist

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

@Z3rio
Copy link
Contributor

Z3rio commented Dec 23, 2025

I dont personally see which way this adds any value. As any script using qbcore would anyways have to import the QBCore object, and would therefore already have access to that value - the same way your proposed export does.

I do like the idea though, but for it to actually be effective, we would ideally need to refactor quite a lot of qbcore to work with exports instead, if the endgoal is to not have ot import the core object.

@ThatMadCap
Copy link

any script using qbcore would anyways have to import the QBCore object

Changes were made to the core recently that allow framework data to be exposed without needing to call the entire framework object. For instance you can request just shared vehicles, jobs, player functions etc.

As I see it this PR is in line with those recent changes.

@Cocodrulo
Copy link
Contributor Author

any script using qbcore would anyways have to import the QBCore object

Changes were made to the core recently that allow framework data to be exposed without needing to call the entire framework object. For instance you can request just shared vehicles, jobs, player functions etc.

As I see it this PR is in line with those recent changes.

Yes, I think is a approach that can be use better in dimanic code. The current functions in the core are one for each shared type, here you use a string to select the shared namespace allowing you to choose a shared namespace by code without large if statements (switch-like) to ge the data

@Z3rio
Copy link
Contributor

Z3rio commented Dec 31, 2025

any script using qbcore would anyways have to import the QBCore object

Changes were made to the core recently that allow framework data to be exposed without needing to call the entire framework object. For instance you can request just shared vehicles, jobs, player functions etc.

As I see it this PR is in line with those recent changes.

Oh, sorry about that then. I will need to look into this. Disgard my statement above entirely.

Thank you for making me aware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants