MCPcopy Create free account
hub / github.com/dmlc/dmlc-core / operator()

Method operator()

include/dmlc/lua.h:674–689  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

672
673template<typename... Args>
674inline 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
691template<typename T>
692inline LuaRef& LuaRef::SetField(const std::string& key, const T& value) { // NOLINT(*)

Callers

nothing calls this directly

Calls 3

for_eachFunction · 0.85
PRun_Method · 0.80
SetByPopStack_Method · 0.80

Tested by

no test coverage detected