Skip to content

Using 'parent' as table field should also be reserved? #244

Closed Answered by Sainan
Jackzmc asked this question in Q&A
Discussion options

You must be logged in to vote

parent has to be reserved for table constructors as otherwise the following would not be valid:

class Entity
	__name = "Entity"
end

class Human extends Entity
	__name = "Human"

	function getHierarchy()
		return { self, parent }
	end
end

local h = new Human()

for h:getHierarchy() as t do
	print(t.__name)
end

As for shorthand accessor syntax, Pluto can remove this restriction: #245

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Sainan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants