MCPcopy Create free account
hub / github.com/defold/defold / CompScriptUpdateInternal

Function CompScriptUpdateInternal

engine/gameobject/src/gameobject/comp_script.cpp:227–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225
226
227 static UpdateResult CompScriptUpdateInternal(const ComponentsUpdateParams& params, ScriptFunction function, ComponentsUpdateResult&)
228 {
229 lua_State* L = GetLuaState(params.m_Context);
230 int top = lua_gettop(L);
231 (void)top;
232 UpdateResult result = UPDATE_RESULT_OK;
233 RunScriptParams run_params;
234 run_params.m_UpdateContext = params.m_UpdateContext;
235 CompScriptWorld* script_world = (CompScriptWorld*)params.m_World;
236 uint32_t size = script_world->m_Instances.Size();
237 for (uint32_t i = 0; i < size; ++i)
238 {
239 HScriptInstance script_instance = script_world->m_Instances[i];
240 if (script_instance->m_Update)
241 {
242 ScriptResult ret = RunScript(L, script_instance->m_Script, function, script_instance, run_params);
243 if (ret == SCRIPT_RESULT_FAILED)
244 {
245 result = UPDATE_RESULT_UNKNOWN_ERROR;
246 }
247 }
248 }
249
250 assert(top == lua_gettop(L));
251 return result;
252 }
253
254 UpdateResult CompScriptUpdate(const ComponentsUpdateParams& params, ComponentsUpdateResult& update_result)
255 {

Callers 3

CompScriptUpdateFunction · 0.85
CompScriptFixedUpdateFunction · 0.85
CompScriptLateUpdateFunction · 0.85

Calls 5

lua_gettopFunction · 0.85
GetLuaStateFunction · 0.70
RunScriptFunction · 0.70
assertFunction · 0.50
SizeMethod · 0.45

Tested by

no test coverage detected