How can I import a script just to use the functions that are declared in it?

44 views
Skip to first unread message

Quati Saboroso

unread,
Oct 16, 2019, 8:46:52 PM10/16/19
to DroidScript
I tried using app.LoadScript() but when I call the function I get the error saying that the function was not declared. (all i want is to use the functions that are in other files, is it possible using droidscript? any tips?)

file1
...
app
.LoadScript("file2.js");

foo
();



file2
function foo()
{
  app
.ShowPopup("hello, world!");
}


Symbroson

unread,
Oct 16, 2019, 9:19:04 PM10/16/19
to DroidScript
app.LoadScript is asynchronous. Define a callback function as second parameter (or use the synchronius equivalent app.Script but that's not recommended)

Symbroson

unread,
Oct 17, 2019, 2:58:03 PM10/17/19
to DroidScript
Note that using app.Script is no problem when loading local files
Reply all
Reply to author
Forward
0 new messages