trumanzhao/luna

函数调用结束后,没有把返回结果pop出来

Closed this issue · 1 comments

函数调用结束后,没有把返回结果pop出来。几个类似的函数都存在相同的问题。

template <typename... ret_types, typename... arg_types>
bool lua_call_table_function(lua_State* L, std::string* err, const char table[], const char function[], std::tuple<ret_types&...>&& rets, arg_types... args) {
    lua_get_table_function(L, table, function);
    int _[] = { 0, (native_to_lua(L, args), 0)... };
    if (!lua_call_function(L, err, sizeof...(arg_types), sizeof...(ret_types)))
        return false;
    lua_to_native_mutil(L, rets, std::make_index_sequence<sizeof...(ret_types)>());
    return true;
}

已修正,之前本意是该系列函数使用者应该使用lua_guard来保护lua栈.
但内部加个清理确实会更好用一些.