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

Function CompScriptSetProperties

engine/gameobject/src/gameobject/comp_script.cpp:814–844  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

812 }
813
814 PropertyResult CompScriptSetProperties(const ComponentSetPropertiesParams& params)
815 {
816 HScriptInstance script_instance = (HScriptInstance)*params.m_UserData;
817 SetPropertySet(script_instance->m_Properties, PROPERTY_LAYER_INSTANCE, params.m_PropertySet);
818
819 lua_State* L = GetLuaState(script_instance);
820
821 int top = lua_gettop(L);
822 (void)top;
823
824 dmScript::GetInstance(L);
825 void* user_data = lua_touserdata(L, -1);
826 lua_pop(L, 1);
827
828 lua_rawgeti(L, LUA_REGISTRYINDEX, script_instance->m_InstanceReference);
829 dmScript::SetInstance(L);
830
831 lua_rawgeti(L, LUA_REGISTRYINDEX, script_instance->m_ScriptDataReference);
832 PropertyResult result = PropertiesToLuaTable(script_instance->m_Instance, script_instance->m_Script, script_instance->m_Properties, L, -1);
833 lua_pop(L, 1);
834
835 if (user_data != 0x0) {
836 lua_pushlightuserdata(L, user_data);
837 } else {
838 lua_pushnil(L);
839 }
840 dmScript::SetInstance(L);
841
842 assert(top == lua_gettop(L));
843 return result;
844 }
845
846 static bool FindPropertyNameFromEntries(dmPropertiesDDF::PropertyDeclarationEntry* entries, uint32_t entry_count, dmhash_t id, const char** out_key, dmhash_t** out_element_ids)
847 {

Callers

nothing calls this directly

Calls 11

SetPropertySetFunction · 0.85
lua_gettopFunction · 0.85
lua_touserdataFunction · 0.85
lua_rawgetiFunction · 0.85
SetInstanceFunction · 0.85
PropertiesToLuaTableFunction · 0.85
lua_pushlightuserdataFunction · 0.85
lua_pushnilFunction · 0.85
GetLuaStateFunction · 0.70
GetInstanceFunction · 0.50
assertFunction · 0.50

Tested by

no test coverage detected