Skip to content

Nested scope property #118

Description

@nndda

Allow nested properties of a scope:

scope.object.property = value
scope.object.method( args )

I think it can be done by utilizing Object.get_indexed() and Object.set_indexed().

  • Property manipulation:

    scope_obj.set_indexed(^"object:property", value)
  • Function call:

    (scope_obj.get_indexed(^"object:method") as Callable).call(args)

Parsing

On parse time, the property path need to be identified...

scope.object.property = value
      ^             ^
      object.property

...and then turned into a NodePath:

^"object:property"

Error handling

To see if a scope has the property path, check if get_indexed() returns null:

get_indexed(^"object:...") == null

Compatibility

It works fine with a single-depth property, so it should be backward compatible.

Performance

I don't know the speed difference between get_indexed() and just get(). But it should be negligible.
If there's a considerable performance difference, we'll use get() for non-nested property instead.

Limitation

It works even for dictionaries, but not array.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestparserAnything related to Dialogue parser function

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions