er2.resetCallback 44

Unassign a callback by it's Id.


Return value

Return TypeDescription
boolTrue if the callback was correctly unassigned

Parameters

ParameterTypeDescription
1stringId of the callback to unassign

Examples

Example 175

-- Define any Lua function as your callback.
function MyCustomCallback(spawnedUnit)
    print('MyCustomCallback called with parameter: ' .. spawnedUnit)
end

-- Register the callback from Lua. In this example the callback will be called every time a soldier is spawned.
er2.setCallback("soldier_spawned", MyCustomCallback)

-- Do something...

-- Reset the callback, so it will no longer be called
er2.resetCallback("soldier_spawned")

Back to Scripting API