1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2026-01-20 22:24:38 +01:00

Attempt to fix function binding to comply with changes to StackStrF.

Various other changes to fix other issues related to changes in StackStrF behavior.
This commit is contained in:
Sandu Liviu Catalin
2018-10-24 21:37:51 +03:00
parent 107ddea5fd
commit d556364ecf
4 changed files with 133 additions and 132 deletions

View File

@@ -46,7 +46,7 @@ namespace Sqrat {
//
template <class R> struct SqGlobalProxy {
template <class... A> static SQInteger Run(HSQUIRRELVM vm, SQInteger idx) {
ArgFwd<A...> a{SQ_OK};
ArgFwd<A...> a;
a.Call(vm, idx, [](HSQUIRRELVM vm, A... a) {
typedef R(*M)(A...);
M* method;
@@ -54,7 +54,7 @@ template <class R> struct SqGlobalProxy {
R ret = (*method)(a...);
PushVar(vm, ret);
});
return SQ_FAILED(a.mRes) ? a.mRes : 1;
return 1;
}
};
@@ -64,7 +64,7 @@ template <class R> struct SqGlobalProxy {
template <class R> struct SqGlobalProxy<R&> {
template <class... A> static SQInteger Run(HSQUIRRELVM vm, SQInteger idx) {
ArgFwd<A...> a{SQ_OK};
ArgFwd<A...> a;
a.Call(vm, idx, [](HSQUIRRELVM vm, A... a) {
typedef R&(*M)(A...);
M* method;
@@ -72,7 +72,7 @@ template <class R> struct SqGlobalProxy<R&> {
R& ret = (*method)(a...);
PushVarR(vm, ret);
});
return SQ_FAILED(a.mRes) ? a.mRes : 1;
return 1;
}
};
@@ -82,14 +82,14 @@ template <class R> struct SqGlobalProxy<R&> {
template <> struct SqGlobalProxy<void> {
template <class... A> static SQInteger Run(HSQUIRRELVM vm, SQInteger idx) {
ArgFwd<A...> a{SQ_OK};
ArgFwd<A...> a;
a.Call(vm, idx, [](HSQUIRRELVM vm, A... a) {
typedef void(*M)(A...);
M* method;
sq_getuserdata(vm, -1, reinterpret_cast<SQUserPointer*>(&method), nullptr);
(*method)(a...);
});
return SQ_FAILED(a.mRes) ? a.mRes : 0;
return 0;
}
};