Leviathan game engine
Delegates in scripts

Registering to a delegate and firing it works like this:

// Receive this Delegate from somewhere
Delegate@ delegate;
void Callback(NamedVars@ variables){
// Read provided values from variables and do something
LOG_INFO("Delegate fired");
// Registering
// Firing the delegate
NamedVars@ variables = NamedVars();
// Add parameters to variables if needed
// variables.AddValue(ScriptSafeVariableBlock("param1", 1));
Some C++ classes directly own a Leviathan::Delegate. This means that handles to delegates are not safe to store. So register your callback and let go of the handle.