Skip to content

TinkerStorm/fivem-resource-context

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

fivem-resource-context

A simplified resource to gather metadata for a key on a specific resource.

File manifest (./resource_context)

Copy this from your zip file / repo clone to your server environment.

  • fx_manifest.lua
  • ./index.js is the logic of the code itself.
  • README.md is there as a minimalist version of this readme, only including details of what it exports and where it originates from.
  • LICENSE is a copy of the same one found at the root of the project.

Unnecessary files (./reference/*)

  • ./index.ts is the file this code was derived from... yes it was written in TypeScript first, then it was downgraded.
  • ./global.d.ts is 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.

Utilizing

// 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)
end

Support

For support with this resource, please join the Discord server.

About

A simplified resource to gather metadata for a key on a specific resource.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Contributors