mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-18 19:47:15 +01:00
Update sqratArray.h
This commit is contained in:
parent
2b6ba1d4c1
commit
a72cc4fccf
@ -580,12 +580,13 @@ public:
|
|||||||
template<class F, class... A>
|
template<class F, class... A>
|
||||||
ArrayBase& AppendFrom(F&& func, A &&... a) {
|
ArrayBase& AppendFrom(F&& func, A &&... a) {
|
||||||
HSQUIRRELVM vm = SqVM();
|
HSQUIRRELVM vm = SqVM();
|
||||||
|
const StackGuard sg(vm);
|
||||||
sq_pushobject(vm, GetObj());
|
sq_pushobject(vm, GetObj());
|
||||||
while (func(vm, std::forward< A >(a)...))
|
while (func(vm, std::forward< A >(a)...))
|
||||||
{
|
{
|
||||||
sq_arrayappend(vm, -2);
|
sq_arrayappend(vm, -2);
|
||||||
}
|
}
|
||||||
sq_pop(vm,1); // pop array
|
//sq_pop(vm,1); // pop array
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -602,12 +603,13 @@ public:
|
|||||||
template<class F, class... A>
|
template<class F, class... A>
|
||||||
ArrayBase& AppendFromCounted(F&& func, A &&... a) {
|
ArrayBase& AppendFromCounted(F&& func, A &&... a) {
|
||||||
HSQUIRRELVM vm = SqVM();
|
HSQUIRRELVM vm = SqVM();
|
||||||
|
const StackGuard sg(vm);
|
||||||
sq_pushobject(vm, GetObj());
|
sq_pushobject(vm, GetObj());
|
||||||
for (SQInteger i = 0; func(vm, i, std::forward< A >(a)...); ++i)
|
for (SQInteger i = 0; func(vm, i, std::forward< A >(a)...); ++i)
|
||||||
{
|
{
|
||||||
sq_arrayappend(vm, -2);
|
sq_arrayappend(vm, -2);
|
||||||
}
|
}
|
||||||
sq_pop(vm,1); // pop array
|
//sq_pop(vm,1); // pop array
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user