clone a node * Make a clone instance of a node. The cloned node will be identical to the * original node, except the id which is generated as the string "node" plus * a sequential unsigned integer value. * This function does not clone the supplied node's children nodes. * Use gui.clone_tree for that purpose. * * @name gui.clone * @param node [type:node] node
| 3823 | * @return clone [type:node] the cloned node |
| 3824 | */ |
| 3825 | static int LuaClone(lua_State* L) |
| 3826 | { |
| 3827 | int top = lua_gettop(L); |
| 3828 | (void) top; |
| 3829 | |
| 3830 | HNode hnode; |
| 3831 | LuaCheckNodeInternal(L, 1, &hnode); |
| 3832 | |
| 3833 | Scene* scene = GuiScriptInstance_Check(L); |
| 3834 | HNode out_node; |
| 3835 | dmGui::Result result = dmGui::CloneNode(scene, hnode, &out_node); |
| 3836 | switch (result) |
| 3837 | { |
| 3838 | case dmGui::RESULT_OUT_OF_RESOURCES: |
| 3839 | return luaL_error(L, "Not enough resources to clone the node"); |
| 3840 | case dmGui::RESULT_OK: |
| 3841 | MoveNodeAbove(scene, out_node, hnode); |
| 3842 | LuaPushNode(L, scene, out_node); |
| 3843 | assert(top + 1 == lua_gettop(L)); |
| 3844 | return 1; |
| 3845 | default: |
| 3846 | return luaL_error(L, "An unexpected error occurred"); |
| 3847 | } |
| 3848 | } |
| 3849 | |
| 3850 | static int HashTableIndex(lua_State* L) |
| 3851 | { |
nothing calls this directly
no test coverage detected