MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / invoke

Method invoke

source/game/scripting/StarLuaComponents.hpp:192–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190
191template <typename Ret, typename... V>
192Maybe<Ret> LuaBaseComponent::invoke(String const& name, V&&... args) {
193 if (!checkInitialization())
194 return {};
195
196 try {
197 auto method = m_context->getPath(name);
198 if (method == LuaNil)
199 return {};
200 return m_context->luaTo<LuaFunction>(std::move(method)).invoke<Ret>(std::forward<V>(args)...);
201 } catch (LuaException const& e) {
202 Logger::error("Exception while invoking lua function '{}'. {}", name, outputException(e, true));
203 setError(printException(e, false));
204 return {};
205 }
206}
207
208template <typename Ret>
209Maybe<LuaValue> LuaBaseComponent::eval(String const& code) {

Callers 15

dismissCompanionMethod · 0.45
callScriptMethod · 0.45
teleportOutMethod · 0.45
destroyMethod · 0.45
hitOtherMethod · 0.45
updateMethod · 0.45
callScriptMethod · 0.45
applyDamageMethod · 0.45
destroyMethod · 0.45
callScriptMethod · 0.45
BehaviorStateMethod · 0.45
consumeResourceMethod · 0.45

Calls 4

errorFunction · 0.85
outputExceptionFunction · 0.50
printExceptionFunction · 0.50
getPathMethod · 0.45

Tested by

no test coverage detected