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

Function LuaSetParticlefx

engine/gui/src/gui_script.cpp:4867–4886  ·  view source on GitHub ↗

Sets a particle fx * * Set the paricle fx for a gui node * * @name gui.set_particlefx * @param node [type:node] node to set particle fx for * @param particlefx [type:hash|string] particle fx id */

Source from the content-addressed store, hash-verified

4865 * @param particlefx [type:hash|string] particle fx id
4866 */
4867 static int LuaSetParticlefx(lua_State* L)
4868 {
4869 DM_LUA_STACK_CHECK(L, 0);
4870
4871 HNode hnode;
4872 LuaCheckNodeInternal(L, 1, &hnode);
4873
4874 dmhash_t particlefx_id = dmScript::CheckHashOrString(L, 2);
4875 Scene* scene = GuiScriptInstance_Check(L);
4876 Result r = SetNodeParticlefx(scene, hnode, particlefx_id);
4877 if (r == RESULT_WRONG_TYPE) {
4878 return DM_LUA_ERROR("Can only set particle system on particlefx nodes!");
4879 }
4880 else if (r == RESULT_RESOURCE_NOT_FOUND) {
4881 char name[128];
4882 return DM_LUA_ERROR("No particle system named: '%s'", dmScript::GetStringFromHashOrString(L, 2, name, sizeof(name)));
4883 }
4884
4885 return 0;
4886 }
4887
4888 /*# Gets a particle fx
4889 *

Callers

nothing calls this directly

Calls 5

LuaCheckNodeInternalFunction · 0.85
CheckHashOrStringFunction · 0.85
GuiScriptInstance_CheckFunction · 0.85
SetNodeParticlefxFunction · 0.70

Tested by

no test coverage detected