mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 03:51:50 +00:00
fix lua::create_lambda
This commit is contained in:
parent
b8944f86c6
commit
40cdebb175
1 changed files with 2 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue