MCPcopy Create free account
hub / github.com/crownengine/crown / unicast

Function unicast

src/world/script_world.cpp:174–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

172
173 ///
174 void unicast(ScriptWorld &sw
175 , const char *function_name
176 , ScriptId script_inst
177 , const ArgType::Enum *arg_types
178 , const Arg *args
179 , u32 num_args
180 )
181 {
182 if (sw._disable_callbacks)
183 return;
184
185 LuaStack stack(sw._lua_environment->L);
186
187 lua_rawgeti(stack.L, LUA_REGISTRYINDEX, sw._script[sw._data[script_inst.i].script_i].module_ref);
188 lua_getfield(stack.L, -1, function_name);
189
190 if (lua_isnil(stack.L, -1)) {
191 stack.pop(2);
192 return;
193 }
194
195 stack.push_args(arg_types, args, num_args);
196
197 int status = sw._lua_environment->call(num_args, 0);
198 if (status != LUA_OK) {
199 report(stack.L, status);
200 device()->pause();
201 }
202 stack.pop(1);
203 }
204
205 void units_with_script(ScriptWorld &sw, Array<Index> &index, const UnitId *units, u32 num)
206 {

Callers 1

update_sceneMethod · 0.85

Calls 8

deviceFunction · 0.85
push_argsMethod · 0.80
lua_rawgetiFunction · 0.50
lua_getfieldFunction · 0.50
reportFunction · 0.50
popMethod · 0.45
callMethod · 0.45
pauseMethod · 0.45

Tested by

no test coverage detected