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

Function broadcast

src/world/script_world.cpp:110–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108 }
109
110 void broadcast(ScriptWorld &sw
111 , const char *function_name
112 , const ArgType::Enum *arg_types
113 , const Arg *args
114 , u32 num_args
115 )
116 {
117 if (sw._disable_callbacks)
118 return;
119
120 LuaStack stack(sw._lua_environment->L);
121
122 for (u32 i = 0; i < array::size(sw._script); ++i) {
123 lua_rawgeti(stack.L, LUA_REGISTRYINDEX, sw._script[i].module_ref);
124 lua_getfield(stack.L, -1, function_name);
125
126 if (lua_isnil(stack.L, -1)) {
127 stack.pop(2);
128 continue;
129 }
130
131 stack.push_args(arg_types, args, num_args);
132
133 int status = sw._lua_environment->call(num_args, 0);
134 if (status != LUA_OK) {
135 report(stack.L, status);
136 device()->pause();
137 }
138 stack.pop(1);
139 }
140 }
141
142 void multicast(ScriptWorld &sw
143 , const char *function_name

Callers 1

update_sceneMethod · 0.85

Calls 9

deviceFunction · 0.85
push_argsMethod · 0.80
sizeFunction · 0.50
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