Default property handler?

For AI and campaign script related discussions and questions
Post Reply
User avatar
aubergine
Professional
Professional
Posts: 3459
Joined: 10 Oct 2010, 00:58
Contact:

Default property handler?

Post by aubergine »

Is there any way to implement a default property handler in JS API?

For example, if I have an object "foo" that does not have a ".bar" property, then if I try accessing foo.bar the default property handler would be invoked so I could still return something. This sort of functionality would only be required for certain types of object.

Something like Mozilla's __noSuchMethod__ but that would be like a default getter/setter for properties (so the getter could return any value, including a function).
"Dedicated to discovering Warzone artefacts, and sharing them freely for the benefit of the community."
-- https://warzone.atlassian.net/wiki/display/GO
Post Reply