Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return picked instances from events-based free functions #5823

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

D8H
Copy link
Collaborator

@D8H D8H commented Oct 22, 2023

@arthuro555
Copy link
Contributor

Glad to see this is back on track :D
Best of luck working on this 💪

@D8H D8H changed the title WIP: Following of "Return objects from events based extensions" Following of "Return objects from events based extensions" Oct 29, 2023
@D8H D8H changed the title Following of "Return objects from events based extensions" Return picked instances from events-based free functions Oct 29, 2023
@D8H
Copy link
Collaborator Author

D8H commented Oct 29, 2023

As explained, in the following comment:

@D8H D8H marked this pull request as ready for review October 29, 2023 16:09
@D8H D8H requested a review from 4ian as a code owner October 29, 2023 16:09
@4ian
Copy link
Owner

4ian commented Nov 7, 2023

I want to be sure to understand well this:

  • When a function (let's say, a condition) is called, we pass object lists (Hashtable<RuntimeObject[]>). In most cases, this is an "object lists" (Hashtable<RuntimeObject[]>) containing either all instances, or instances already filtered by some other conditions.
    • In rare case, we may want an empty "object lists" (this is the case when your function is creating a new object. You want the object as parameter, but with an empty list).
  • This "object lists" (Hashtable<RuntimeObject[]>) is passed to the function. Most of the time, the function just uses it for conditions, creating new arrays that are filtered.
  • When the function finishes, we get out of the function and continue with the next condition (if the condition was true). So far, no filtering could have happened, because we did not change the "objects list" (Hashtable<RuntimeObject[]>).

Here with this change:

  • We allow to filter the list passed as argument to the function. This means we filter eventsFunctionContext.getObjectsLists("name of the object passed to the function")... this is actually already written in the doc You can alter the list and this will alter the objects picked for the next conditions/actions/events..
  • So it seems all good.
  • Question though: what if I use an empty object lists as the parameter of my function? I will receive empty lists, which is fine. Let's say I then create an object in the function. Will this add: 1) add the object to the objects list automatically, I can just finish my function and it works or 2) do I need to use this new action?

My thinking is that 1) is the answer, because when you use "Create", you've not run any condition on the object before (it would not make sense. Well you can but these conditions will be false), so the "Create" will directly add the object to the object lists passed as parameter... is this correct?
Can we add a test case for it?

@4ian
Copy link
Owner

4ian commented Nov 13, 2023

As discussed, let's add a test if two objects created in a function (using an object passed as parameter) and pick only the second thanks to this action, and see if it's properly "returned" to the caller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants