mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2026-11-03 18:37:09 +01:00
Simplify the script function wrapper.
This commit is contained in:
1 parent
e48cb3b43c
commit
4c111d4139
2 files changed
+112
-279
No files matched your search
+11
-23
@@ -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