InjectResource

Queue a Lua code injection into a target resource’s VM.

Syntax

Susano.InjectResource(resourceName, luaCode [, injectionType]) -> void

Parameters

resourceName (string): Target resource identifier. Use "any" to inject in the first available resource.

luaCode (string): Lua source to execute inside that resource.

injectionType (Susano.InjectionType, optional): Injection type:

  • Susano.InjectionType.NEW_THREAD: inject inside a new thread

  • Susano.InjectionType.NO_THREAD: inject in the first available thread (do NOT call Wait/ Citizen.Wait unless you create a thread)

  • Susano.InjectionType.WHOOK_THREAD: undocumented on purpose.

  • Susano.InjectionType.WHOOK_NOTHREAD: undocumented on purpose.

Return(s)

None

Behavior

Requires exactly two string arguments; otherwise raises a Lua error.

Code runs in the target resource’s environment, not Susano’s sandbox.

Susano API is unavailable inside injected code (not isolated). Do not call Susano.* there.

Use the resource’s own globals and natives. Namespaces and upvalues differ from Susano.

Example(s)

Last updated