RESOURCE INJECTION
InjectResource
Injects a resource into the current session.
Syntax
ONYX.InjectResource(resourceName, luaCode, injectionType, chunkName)Parameters
resourceName(string) — Target resource; "any" picks the first available resource.luaCode(string) — Source code to execute inside the target resource VM.injectionType(integer (optional)) — Defaults to ONYX.NEW_THREAD; ONYX.NO_THREAD runs directly in the first available thread.chunkName(string (optional)) — Name shown when the chunk loads; defaults to @resourceName/client.lua.
Return(s)
None
Behavior
- Queues Lua code for injection into the target resource VM; the injection is not immediate.
- The injected chunk runs in the resource own environment, not the loader sandbox, so ONYX.* is not available there.
- Use GetInjectableResources and GetResourceFiles to discover valid targets.
Example(s)
ONYX.InjectResource("es_extended", "print(\"hello from ONYXS\")")