MCPcopy Create free account
hub / github.com/Norbyte/bg3se / OsiLuaModQuery

Function OsiLuaModQuery

BG3Extender/Osiris/Functions/LuaFunctions.cpp:82–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80
81 template <uint32_t TInParams>
82 bool OsiLuaModQuery(OsiArgumentDesc & args)
83 {
84 LuaServerPin lua(ExtensionState::Get());
85 if (!lua) {
86 OsiErrorS("Called when the Lua VM has not been initialized!");
87 return false;
88 }
89
90 auto mod = args[0].String;
91 auto func = args[1].String;
92 auto numArgs = args.Count() - 2;
93
94 std::vector<CustomFunctionParam> signature;
95 signature.reserve(numArgs);
96 for (uint32_t i = 0; i < TInParams; i++) {
97 signature.push_back(CustomFunctionParam{
98 QueryArgNames[i], args[i + 2].TypeId, FunctionArgumentDirection::In
99 });
100 }
101
102 for (uint32_t i = 0; i < numArgs - TInParams; i++) {
103 signature.push_back(CustomFunctionParam{
104 QueryOutArgNames[i], args[i + TInParams + 2].TypeId, FunctionArgumentDirection::Out
105 });
106 }
107
108 return lua->Query(mod, func, nullptr, signature, *args.NextParam->NextParam);
109 }
110 }
111
112 template <unsigned TInParams>

Callers

nothing calls this directly

Calls 4

CountMethod · 0.80
QueryMethod · 0.80
reserveMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected