InjectResource

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

Syntax

Susano.InjectResource(resourceName, luaCode) -> 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.

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)

-- inject a simple logger into resource "gamemode"
Susano.InjectResource("gamemode", [[
  print("[inject] gamemode init hook installed")
  -- Susano.* calls will NOT work here
]])

-- inject code that overrides a function in the target resource
Susano.InjectResource("ui_resource", [[
  local old = _G.ShowNotification
  _G.ShowNotification = function(msg)
    return old("[INJECTED] "..tostring(msg))
  end
]])

-- inject into the first available resource
Susano.InjectResource("any", [[
  print("[inject] any init hook installed")
  -- Susano.* calls will NOT work here
]])

Last updated