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

bug: Function override with array params not passed to JS #229

Open
vrachels opened this issue Nov 2, 2018 · 2 comments
Open

bug: Function override with array params not passed to JS #229

vrachels opened this issue Nov 2, 2018 · 2 comments

Comments

@vrachels
Copy link

@vrachels vrachels commented Nov 2, 2018

STR:
create a custom blueprint
create a function that takes an array (ie, strings) as a parameter (TestFn)
extends the custom blueprint in JS with an override for TestFn
Call the function via a blueprint with some valid non-zero length array (ie, MakeArray node)
note that the array is empty when the JS executes.

Possible Fix (minimally tested locally)
in JavascriptContext_Private.cpp
UJavascriptGeneratedFunction::Thunk
when iterating properties to copy into NewStack.Locals, params that are CPF_OutParm should also check for CPF_ReferenceParm and if so, also copy it into Locals instead of only the out list.

bool bIsOutParm = Property->PropertyFlags & CPF_OutParm;;
bool bIsInParm = !bIsOutParam || ((Property->PropertyFlags & CPF_ReferenceParm) != 0);

uint8* Param = nullptr;
if (bIsInParam)
{
  Param = Property->ContainerPtrToValuePtr<uint8>(NewStack.Locals);
  Property->InitializeValue_InContainer(NewStack.Locals);
}
Stack.Step(Stack.Object, Param);

if (bIsOutParam)
... // everything from before except the call to Stack.Step, and no else clause
@crocuis

This comment has been minimized.

Copy link
Contributor

@crocuis crocuis commented Nov 3, 2018

The dynamic array in unreal.js has a limit. Please read https://github.com/ncsoft/Unreal.js/wiki/Dynamic-array:-Limitation.

@vrachels

This comment has been minimized.

Copy link
Author

@vrachels vrachels commented Nov 6, 2018

Yes, I was aware of that issue. It doesn't seem relevant to the problem at hand, which is that the array is never being passed to the javascript in the first place, regardless of whether I want to edit it.

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.