fix lua::create_lambda

This commit is contained in:
MihailRis 2025-01-15 07:11:28 +03:00
parent b8944f86c6
commit 40cdebb175

View File

@ -270,12 +270,13 @@ scripting::common_func lua::create_lambda(State* L) {
return [=](const std::vector<dv::value>& args) -> dv::value {
if (!get_from(L, LAMBDAS_TABLE, *funcptr, false))
return nullptr;
int top = gettop(L) + 1;
int top = gettop(L) - 1;
for (const auto& arg : args) {
pushvalue(L, arg);
}
if (call(L, args.size(), 1)) {
int nres = gettop(L) - top;
assert(nres >= 0);
if (nres) {
auto result = tovalue(L, -1);
pop(L, 1 + nres);