Skip to content

Component may not work when added to a function call #1822

Description

@ohmtal

Describe the bug
When working on ElfScript i found out, that using a component field attached to a function call does not work. I checked the current Torque3D source and I'm sure there is the same behavior. Was not able to test it, because the current Torque3D does not build on Linux (assimp/code/Common/ZipArchiveIOSystem.cpp:57:14: fatal error: unzip.h: No such file or directory)

To Reproduce

function foo() { return "1 2 3"; }
echo(foo().x); // should return 1 but is empty 
$obj = new ScriptObject() { class = "TestClass"; };
function  TestClass::foo() { return "1 2 3"; }
echo($obj.foo().x); // return the object ID ($obj) not 1 

If both are working fine on Torque3D forget this post ;)

Expected behavior
Also function calls with component should return the correct value.

Screenshots

  • not available -

System Info (please complete the following information as applicable):

  • OS: [Arch Linux]
  • Engine Version [current from github repo]

Additional context
As i said, i can't test it with Torque3D and did only read the Sources. My fix in ElfScript was:
1.) At the end of OP_CALLFUNC i did set the Script::gEvalState.currentVariable = nullptr;
2.) in getFieldComponent i use the current stack as result stack , but this require, that getFieldComponent know the current stack string - i looked at old sources - this was the default fallback when no obj and field are there

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions