1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00

Update sqratFunction.h

This commit is contained in:
Sandu Liviu Catalin 2021-02-05 13:31:52 +02:00
parent 18a52bc536
commit d73ee70395

View File

@ -215,7 +215,7 @@ struct Function {
return cenv; return cenv;
} }
// Runs the Function and returns its value as a LightObj // Runs the Function and returns its value as a LightObj
template<class... Args> LightObj Eval(Args &&... args) { template<class... Args> LightObj Eval(Args &&... args) const {
static constexpr unsigned ARGC = sizeof...(Args) + 1; // + environment static constexpr unsigned ARGC = sizeof...(Args) + 1; // + environment
HSQUIRRELVM vm = SqVM(); HSQUIRRELVM vm = SqVM();
const SQInteger top = sq_gettop(vm); const SQInteger top = sq_gettop(vm);
@ -253,7 +253,7 @@ struct Function {
return ret; return ret;
} }
// Runs the Function and returns its value as a SharedPtr // Runs the Function and returns its value as a SharedPtr
template<class R, class... Args> SharedPtr<R> Evaluate(Args &&... args) { template<class R, class... Args> SharedPtr<R> Evaluate(Args &&... args) const {
static constexpr unsigned ARGC = sizeof...(Args) + 1; // + environment static constexpr unsigned ARGC = sizeof...(Args) + 1; // + environment
HSQUIRRELVM vm = SqVM(); HSQUIRRELVM vm = SqVM();
const SQInteger top = sq_gettop(vm); const SQInteger top = sq_gettop(vm);
@ -293,7 +293,7 @@ struct Function {
} }
// Runs the Function // Runs the Function
template< class... Args > template< class... Args >
void Execute(Args &&... args) { void Execute(Args &&... args) const {
static constexpr unsigned ARGC = sizeof...(Args) + 1; // + environment static constexpr unsigned ARGC = sizeof...(Args) + 1; // + environment
HSQUIRRELVM vm = SqVM(); HSQUIRRELVM vm = SqVM();
const SQInteger top = sq_gettop(vm); const SQInteger top = sq_gettop(vm);
@ -329,7 +329,7 @@ struct Function {
#endif #endif
} }
// Runs the Function // Runs the Function
template< class... Args > void operator() (Args &&... args) { template< class... Args > void operator() (Args &&... args) const {
Execute(std::forward<Args>(args)...); Execute(std::forward<Args>(args)...);
} }
}; };