mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-07-01 06:27:11 +02:00
Simplify the script function wrapper.
This commit is contained in:
@ -202,37 +202,25 @@ class WeakPtr;
|
||||
|
||||
/// @endcond
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Helper class that defines a VM that can be used as a fallback VM in case no other one is given to a piece of code
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Helper class that defines a VM that can be used as a fallback VM in case no other one is given to a piece of code
|
||||
class DefaultVM {
|
||||
private:
|
||||
|
||||
static HSQUIRRELVM& staticVm() {
|
||||
static HSQUIRRELVM& StaticVM() noexcept {
|
||||
static HSQUIRRELVM vm;
|
||||
return vm;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Gets the default VM
|
||||
///
|
||||
/// \return Default VM
|
||||
///
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
static HSQUIRRELVM Get() {
|
||||
return staticVm();
|
||||
// Gets the default VM (copy)
|
||||
static HSQUIRRELVM Get() noexcept {
|
||||
return StaticVM();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Sets the default VM to a given VM
|
||||
///
|
||||
/// \param vm New default VM
|
||||
///
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Gets the default VM (reference)
|
||||
static HSQUIRRELVM & Get_() noexcept {
|
||||
return StaticVM();
|
||||
}
|
||||
// Sets the default VM to a given VM
|
||||
static void Set(HSQUIRRELVM vm) {
|
||||
staticVm() = vm;
|
||||
StaticVM() = vm;
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user