1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-22 14:24:33 +01:00
Files
OpenRCT2/src/openrct2/scripting/ScDisposable.hpp
2020-04-26 14:34:59 +01:00

33 lines
590 B
C++

#pragma once
#include <dukglue/dukglue.h>
#include <functional>
namespace OpenRCT2::Scripting
{
class ScDisposable
{
private:
std::function<void()> _onDispose;
public:
ScDisposable(std::function<void()> onDispose) :
_onDispose(onDispose)
{
}
void dispose()
{
if (_onDispose)
{
_onDispose();
}
}
static void Register(duk_context * ctx)
{
dukglue_register_method(ctx, &ScDisposable::dispose, "dispose");
}
};
}