protected function updates

This commit is contained in:
ThePhD 2016-09-04 10:54:55 -04:00
parent c6540caf67
commit d451271bf4
2 changed files with 5 additions and 2 deletions

1
.gitignore vendored
View File

@ -68,3 +68,4 @@ main.o
lua-5.3.3/
*.pdf
main.lua
LuaJIT-2.1.0/

View File

@ -87,7 +87,8 @@ namespace sol {
protected_function_result invoke(types<>, std::index_sequence<>, std::ptrdiff_t n, handler& h) const {
int stacksize = lua_gettop(base_t::lua_state());
int firstreturn = (std::max)(1, stacksize - static_cast<int>(n) - 1);
int poststacksize = stacksize;
int firstreturn = 1;
int returncount = 0;
call_status code = call_status::ok;
#ifndef SOL_NO_EXCEPTIONS
@ -105,8 +106,9 @@ namespace sol {
try {
#endif // No Exceptions
code = luacall(n, LUA_MULTRET, h);
int poststacksize = lua_gettop(base_t::lua_state());
poststacksize = lua_gettop(base_t::lua_state());
returncount = poststacksize - (stacksize - 1);
firstreturn = (std::max)(1, poststacksize - (returncount - 1) - static_cast<int>(h.valid()));
#ifndef SOL_NO_EXCEPTIONS
}
// Handle C++ errors thrown from C++ functions bound inside of lua