| 672 | |
| 673 | template<typename... Args> |
| 674 | inline LuaRef LuaRef::operator()(Args&& ...args) const { |
| 675 | CHECK(state_ != nullptr) << "LuaRef is nil"; |
| 676 | auto targ = std::make_tuple(std::forward<Args>(args)...); |
| 677 | size_t nargs = sizeof...(Args); |
| 678 | LuaRef ret; |
| 679 | state_->PRun_([this, nargs, &targ, &ret](lua_State* L) { |
| 680 | lua_rawgeti(L, LUA_REGISTRYINDEX, this->ref_); |
| 681 | CHECK(lua_isfunction(L, -1)) |
| 682 | << "Expect to invoke a function but type='" |
| 683 | << lua_typename(L, lua_type(L, -1)) << '\''; |
| 684 | for_each(targ, lua_stack::PushArg{L}); |
| 685 | LUA_CALL(lua_pcall(L, nargs, 1, 0)); |
| 686 | ret.SetByPopStack_(state_); |
| 687 | }); |
| 688 | return ret; |
| 689 | } |
| 690 | |
| 691 | template<typename T> |
| 692 | inline LuaRef& LuaRef::SetField(const std::string& key, const T& value) { // NOLINT(*) |
nothing calls this directly
no test coverage detected