fix lua::create_lambda
This commit is contained in:
parent
b8944f86c6
commit
40cdebb175
@ -270,12 +270,13 @@ scripting::common_func lua::create_lambda(State* L) {
|
|||||||
return [=](const std::vector<dv::value>& args) -> dv::value {
|
return [=](const std::vector<dv::value>& args) -> dv::value {
|
||||||
if (!get_from(L, LAMBDAS_TABLE, *funcptr, false))
|
if (!get_from(L, LAMBDAS_TABLE, *funcptr, false))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
int top = gettop(L) + 1;
|
int top = gettop(L) - 1;
|
||||||
for (const auto& arg : args) {
|
for (const auto& arg : args) {
|
||||||
pushvalue(L, arg);
|
pushvalue(L, arg);
|
||||||
}
|
}
|
||||||
if (call(L, args.size(), 1)) {
|
if (call(L, args.size(), 1)) {
|
||||||
int nres = gettop(L) - top;
|
int nres = gettop(L) - top;
|
||||||
|
assert(nres >= 0);
|
||||||
if (nres) {
|
if (nres) {
|
||||||
auto result = tovalue(L, -1);
|
auto result = tovalue(L, -1);
|
||||||
pop(L, 1 + nres);
|
pop(L, 1 + nres);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user