Skip to content

Commit 4ce7e31

Browse files
committed
remove 'return Return' after luaL_error(...) to enable functions with reference results
1 parent d088498 commit 4ce7e31

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

include/peacalm/luaw.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2819,7 +2819,9 @@ struct luaw::pusher<Return (*)(Args...)> {
28192819
auto param = l.to<std::decay_t<FirstArg>>(i, false, &failed, &exists);
28202820
if (failed) {
28212821
luaL_error(l.L(), "The %dth argument conversion failed", counter);
2822-
return Return(); // never runs here
2822+
// Never runs here.
2823+
// Do not return Return() to enable functions with reference results.
2824+
// return Return();
28232825
}
28242826
bind<Callee, FirstArg, RestArgs...> b(std::forward<Callee>(c),
28252827
std::move(param));
@@ -4786,7 +4788,9 @@ struct luaw::registrar<Return (Class::*)(Args...)> {
47864788
auto f = [mf, &l](ObjectType o, Args... args) -> Return {
47874789
if (!o) {
47884790
luaL_error(l.L(), "Calling member function by null pointer of object");
4789-
return Return(); // never runs here
4791+
// Never runs here.
4792+
// Do not return Return() to enable functions with reference results.
4793+
// return Return();
47904794
}
47914795
PEACALM_LUAW_ASSERT(o);
47924796
return mf(*o, std::move(args)...);

0 commit comments

Comments
 (0)