For Developers

Writing your own resource against the bridge, or moving one over from community_bridge.

You only need this section if you're writing code against Newb_Bridge. Running the scripts needs nothing past Installation and Configuration.

Import the bridge

Each resource that calls bridge.* pulls it in from its own fxmanifest.lua:

shared_scripts {
    '@ox_lib/init.lua',
    '@Newb_Bridge/import.lua',
    -- your shared scripts
}

dependencies {
    'ox_lib',
    'Newb_Bridge',
}

That gives your resource the global bridge table and the resolved Config. A module is loaded the first time you touch it (bridge.inventory, bridge.menu, and so on), while the host preloads every configured provider when it starts. Your resource has to start after Newb_Bridge, since import.lua errors when the bridge isn't running.

Debug which providers loaded

-- Server or client after bridge import
print('Framework:', Config.Framework, Config.Providers.framework)
print('Inventory:', Config.Inventory, Config.Providers.inventory)
print(bridge.framework.getResourceName(), bridge.inventory.getResourceName())

The host also prints a one-time detected scripts: block to the server console on start.

IDE support

Full LuaLS types live in Newb_Bridge/types/types.lua. Point your language server at the bridge resource for autocomplete on bridge.*.

Where to go next

On this page