I want to move parts of my code into external js-files and include them using scriptThread.loadScript(...);
For functions this works pretty well, but not for things outside functions like const, var/let definitions. They are not exported to the main function, nor useable within the script where they are defined.
More worse, when i define a const in the main script, it is not useable within a function in an loaded script.
Is this per design, or is it a bug?
Last edit: devnull 2024-01-20
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It is bug. It worked when I used the old Qt script interpreter (Qt 5.14.2). I migrated to Qt 6.4.3 a few month ago. This version has a new interpeter.
I will look into it when I have time. Thx for reporting this.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You should also check for non-existant functions. If you just call an unknown funciton in the code (e.g. "foo();") and that function does not exist (or just misspelled) the code execution also freezes.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Which version of ScriptCommunictor do you use and on which which platform (Linux, Windows or MacOs) do you use it?
I added foo() to a script and ScriptCommunictor showed an error and the script was stoped (that's how it should be).
I want to move parts of my code into external js-files and include them using
scriptThread.loadScript(...);
For functions this works pretty well, but not for things outside functions like const, var/let definitions. They are not exported to the main function, nor useable within the script where they are defined.
More worse, when i define a const in the main script, it is not useable within a function in an loaded script.
Is this per design, or is it a bug?
Last edit: devnull 2024-01-20
It is bug. It worked when I used the old Qt script interpreter (Qt 5.14.2). I migrated to Qt 6.4.3 a few month ago. This version has a new interpeter.
I will look into it when I have time. Thx for reporting this.
Way cool, great job pal! Glad to get the product better. Until then i just move the parts back into the main script, so no hurry needed.
You should also check for non-existant functions. If you just call an unknown funciton in the code (e.g. "foo();") and that function does not exist (or just misspelled) the code execution also freezes.
Which version of ScriptCommunictor do you use and on which which platform (Linux, Windows or MacOs) do you use it?
I added foo() to a script and ScriptCommunictor showed an error and the script was stoped (that's how it should be).
Last edit: Stefan Zieker 2024-01-22