A simplified resource to gather metadata for a key on a specific resource.
Copy this from your zip file / repo clone to your server environment.
fx_manifest.lua./index.jsis the logic of the code itself.README.mdis there as a minimalist version of this readme, only including details of what it exports and where it originates from.LICENSEis a copy of the same one found at the root of the project.
./index.tsis the file this code was derived from... yes it was written in TypeScript first, then it was downgraded../global.d.tsis the file used to make TypeScript happy, if you intend to inspect or modify the code yourself.Declarations in this file are found within the Natives Reference (docs.fivem.net).
Support for native TypeScript may arrive when I am more confident with FiveM's yarn integration. Source types are a bit off, to say the least.
// JavaScript
const { GetResourceContext, GetResourceIterator } = exports.resource_context;
const resourceEntry = GetResourceContext("myresource", "mydata", 4);
for (const entry of exports.GetResourceIterator("myresource", "mydata")) {
console.log(entry); // { resource, key, value, extra? }
}-- Lua
local getResourceContext = exports.resource_context:getResourceContext
local getResourceIterator = exports.resource_context:getResourceIterator
local resourceEntry = getResourceContext("myresource", "mydata", 4)
for entry in getResourceIterator("myresource", "mydata") do
print(entry)
endFor support with this resource, please join the Discord server.