Talk:Instance (Table)
From Legacy Roblox Wiki
Jump to navigationJump to search
"That's incorrect. If the second argument is not specified, the parent will simply not be set.)"
There is no difference in lua between "not set" and "set to nil", is there?
- Setting the parent to nil while the default parent is already nil anyway would be completely stupid. They only set it to something else if the second argument is specified. Otherwise, it just doesn't set it at all. --JulienDethurens 17:09, 17 April 2012 (EDT)
- It could be that it gets set to whatever the second argument is (passing no value is interpreted as nil, therefore setting it to nil). But there's really no way to tell without knowing at how it was implemented. Mentioning that the Parent defaults to nil is enough. --Anaminus 18:03, 17 April 2012 (EDT)
- The function is a C side function, and these actually make a distinction between nil and no value. I doubt the developers would make the Instance.new function, which is one of the most used functions, more expensive by making it set it to nil even if it's useless, when they could actually just check if an argument has been passed. --JulienDethurens 18:19, 17 April 2012 (EDT)
- It could be that it gets set to whatever the second argument is (passing no value is interpreted as nil, therefore setting it to nil). But there's really no way to tell without knowing at how it was implemented. Mentioning that the Parent defaults to nil is enough. --Anaminus 18:03, 17 April 2012 (EDT)