Framework & Raw
For the cases where you genuinely need to know or reach past which framework is running — these two exist so you're never blocked waiting on a wc_lib update.
Framework introspection
Returns the active framework name.
| Returns | Type |
|---|---|
| name | 'vorp' | 'rsg' | nil |
print(wc:Framework_Get()) -- "vorp"
Boolean check against the active framework.
if wc:Framework_Is('vorp') then
-- e.g. a Honor-skill feature that only exists in VORP's skill system
end
Raw escape hatch
Need something the bridge doesn't cover yet — a specific VORP character setter, an RSG export with no wc_lib equivalent? WCLib.Raw.VORP() / WCLib.Raw.RSG() return the native core object directly.
Framework.Get/Framework.Is (which get flattened into Framework_Get/Framework_Is exports), client/init.lua and server/init.lua only loop over WCLibFramework's members when registering nested-table exports — there is no equivalent loop for WCLibRaw. WCLib.Raw is a table, not a function, so it's skipped by the main export loop too. The practical effect: wc:Raw_VORP() / wc:Raw_RSG() do not exist as callable exports today and will error with "no such export" if you try them from another resource. This is a gap in the library itself, not a documentation choice — see the note on the VORP & RSG compatibility guide.
Returns VORP's native Core object directly. Returns nil with a console warning if vorp_core isn't running.
Usable today only from code that runs inside the wc_libs resource itself — _custom/client.lua and _custom/server.lua load in the same Lua state as WCLib, so they can call WCLib.Raw.VORP() directly without going through the export system at all.
local function setNickname(source, name)
local Core = WCLib.Raw.VORP()
if not Core then return end
local ch = WCLib.GetCharacter(source)
if ch then ch.setNickName(name) end
end
WCLib.SetNickname = setNickname
exports('SetNickname', setNickname) -- now other resources CAN call wc:SetNickname(...)
Returns RSG's native RSGCore object directly. Returns nil with a console warning if rsg-core isn't running. Same export gap as Raw.VORP above.
WCLibFramework one in both client/init.lua and server/init.lua: for fnName, fn in pairs(WCLibRaw) do exports('Raw_' .. fnName, fn) end. Until that ships, wrap any raw call you need in _custom/ and export it yourself, as shown above.
_custom/ so every resource gets the clean version instead of repeating the raw call. See Custom overrides.
Real Wild County example — VORP-only honor bonus
if wc:Framework_Is('vorp') then
wc:ApplySkillBonus(src, 'trading', 10) -- VORP-only skill system, see Skills page
end
Common mistakes
- Reaching for
Raw.VORP()/Raw.RSG()for something wc_libs already wraps — check the sidebar first; duplicating a wrapped function with a raw call means you lose the automatic RSG/VORP normalization. - Calling
Raw.VORP()on a server actually running RSG (or vice versa) — it returnsnilwith a console warning rather than erroring, so always check the return value before using it. - Writing framework-branching code with
if wc:Framework_Is('vorp') then ... else ... endfor something both frameworks already support identically through wc_libs — that's exactly the duplication this library exists to remove. - Forgetting the exported name is
Framework_Get/Framework_Is(underscore, flattened), notFramework.Get— nested tables don't survive the export mechanism, only their member functions do, each prefixed with the table name. - Calling
wc:Raw_VORP()orwc:Raw_RSG()from another resource and expecting it to work — it currently isn't exported at all (see the warning above); you'll get a "no such export" error, not anilreturn.
Troubleshooting
- If
Framework_Get()returnsnil: no supported core was detected when wc_libs started — check the console for[wc_libs] ... NONE DETECTEDand confirmvorp_core/rsg-coreactually starts before wc_libs in your server's resource order. - If both frameworks are installed for a migration period: set
WCLibConfig.ForceFrameworkexplicitly rather than relying on auto-detection, which defaults to VORP and warns when both are present. - If
wc:Raw_VORP()/wc:Raw_RSG()throw a "no such export" error: that's expected with the current build — use the_custom/wrapper pattern above instead of calling it directly from another resource. - If
WCLib.Raw.VORP()/WCLib.Raw.RSG()returnnilfrom inside_custom/: confirm the corresponding core resource'sGetResourceStateis'started', not just present in the resources folder.