Skip to content

Call to Node:duplicate does not trigger duplication #202

@StillWantTea

Description

@StillWantTea

Hello,

I noticed this while actually trying to do some benchmarks but it seems the behaviour for the call to Node:duplicate is not the same as what happens with gdscript, mainly that it doesn't seem to duplicate, the node id that it is given is the same.

You can easily replicate this with:

local luaexample = {
	extends = Node2D,
}

function luaexample:_ready()
	local n = Node:new()
	local d1 = n:duplicate()
	local d2 = n:duplicate()
	print(n, d1, d2)
end

return luaexample

and the gdscript version to compare:

extends Node2D


# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	var n = Node.new()
	var d1 = n.duplicate()
	var d2 = n.duplicate()
	print(n, d1, d2)

If I've just misunderstood how to use the duplicate api then I apologise in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions