diff --git a/lib/base/scriptutils.cpp b/lib/base/scriptutils.cpp index 74c625135..94a0f01cf 100644 --- a/lib/base/scriptutils.cpp +++ b/lib/base/scriptutils.cpp @@ -65,6 +65,7 @@ REGISTER_SAFE_SCRIPTFUNCTION(escape_shell_arg, &Utility::EscapeShellArg); #ifdef _WIN32 REGISTER_SAFE_SCRIPTFUNCTION(escape_create_process_arg, &Utility::EscapeCreateProcessArg); #endif /* _WIN32 */ +REGISTER_SCRIPTFUNCTION(__ptr, &ScriptUtils::Ptr); String ScriptUtils::CastString(const Value& value) { @@ -317,3 +318,7 @@ Array::Ptr ScriptUtils::TrackParents(const Object::Ptr& child) return Array::FromVector(DependencyGraph::GetParents(child)); } +double ScriptUtils::Ptr(const Object::Ptr& object) +{ + return reinterpret_cast(object.get()); +} diff --git a/lib/base/scriptutils.hpp b/lib/base/scriptutils.hpp index 6eaf53a80..a79bb4d6d 100644 --- a/lib/base/scriptutils.hpp +++ b/lib/base/scriptutils.hpp @@ -52,6 +52,7 @@ public: static void Assert(const Value& arg); static String MsiGetComponentPathShim(const String& component); static Array::Ptr TrackParents(const Object::Ptr& parent); + static double Ptr(const Object::Ptr& object); private: ScriptUtils(void);