Storing large quantities of data for use with NUI. Lua or JSON?

, ,

I’m going to store ped clothes data so I can use it in a freemode ped clothes editor. The data will be used to build html dynamically.

I’d like to cover pretty much every piece of clothing in the game and I need to add some custom data pieces that are not already in the client and cannot be “pulled” and iterated over with natives like for example GetNumberOfPedDrawableVariations or GetPedDrawableVariation.

What I’ll need to store for sure are:

  • component id
  • drawable id
  • texture id
  • name
  • category

and for “tops” additionally:

  • shirt decal collection
  • shirt decal hash

Data sets need to be different for male and female (obviously) and will most likely be split into multiple files based on categories too.

I’d like to get some advice about the best way to do it.

Should I use JSON files with objects or lua files with tables? What is more memory-efficient? What is faster to parse? Anyone willing to share some experience?

You can use that natives to pull data. Client have all info about streamed clothes after init.

I spent a lot of time looking at various data dumps available on the internet and .meta files extracted with openiv and I did not see any data that would allow grouping clothes the way they are grouped in GTA Online stores.

Categories aside, I’m not even sure if it’s possible to retrieve a localized name of a component before applying it to the ped as the only way (that I have seen) that would aid in obtaining that information at all is GetHashNameForComponent which requires a ped.

Well, to be honest, I’m not even sure if you can get the localized name from the hash name using natives.

If someone could present an example path of going from component count to component information that includes all of the above data (a set of natives used), that could indeed save me a lot of work, memory and loading time, but I fear that none actually exists.