Just starting out? Need help? Post your questions and find answers here.
-
falsam
- Posts: 288
- Joined: Mon May 05, 2014 9:49 pm
- Location: France
-
Contact:
Post
by falsam »
I code a module that communicates with a JavaScript code. I think the module's declaration is good.
I have located the error in my code and tried to reproduce it with this code snippet. (
Console on)
Code: Select all
EnableExplicit
DeclareModule fake
Global foo.i = 100
Declare Dummy()
EndDeclareModule
Module fake
Procedure Dummy()
! v_foo ++
! console.log(v_foo);
EndProcedure
EndModule
UseModule fake
fake::Dummy()
In my opinion, it looks like a bug or .... (And NO ! This is not a bug)
Thanks for your help.
Last edited by
falsam on Sat Apr 08, 2017 9:05 am, edited 1 time in total.
➽ Windows 11 - jdk-11.0.2 - SB 3.10 - Android 16
➽ https://falsam.com
Sorry for my poor english
-
falsam
- Posts: 288
- Joined: Mon May 05, 2014 9:49 pm
- Location: France
-
Contact:
Post
by falsam »
Another code
Code: Select all
EnableExplicit
DeclareModule fake
Global foo.i = 100
Declare Dummy()
Declare Result()
EndDeclareModule
Module fake
Procedure Dummy()
! v_foo = 200;
! console.log(v_foo);
EndProcedure
Procedure Result()
ProcedureReturn foo
EndProcedure
EndModule
UseModule fake
fake::Dummy()
Debug fake::Result()
No JavaScript error but false result.
➽ Windows 11 - jdk-11.0.2 - SB 3.10 - Android 16
➽ https://falsam.com
Sorry for my poor english
-
Fred
- Site Admin
- Posts: 1821
- Joined: Mon Feb 24, 2014 10:51 am
Post
by Fred »
module variable needs to be prefixed:
Code: Select all
EnableExplicit
DeclareModule fake
Global foo.i = 100
Declare Dummy()
Declare Result()
EndDeclareModule
Module fake
Procedure Dummy()
! fake$v_foo = 200;
! console.log(fake$v_foo);
EndProcedure
Procedure Result()
ProcedureReturn foo
EndProcedure
EndModule
UseModule fake
fake::Dummy()
Debug fake::Result()
You can take a look to spiderbasic.js to see how it is declared if you are mixing JS with SB code and it doesn't work.
-
falsam
- Posts: 288
- Joined: Mon May 05, 2014 9:49 pm
- Location: France
-
Contact:
Post
by falsam »
Thanks Fred for this quick reply. My module works.
➽ Windows 11 - jdk-11.0.2 - SB 3.10 - Android 16
➽ https://falsam.com
Sorry for my poor english