using Toybox.Application as App;
using Toybox.System as Sys;
var m = {
"a" => 1,
"b" => Rez.Drawables.id_b,
"c" => "!"
};
var a = [
1,
Rez.Drawables.id_b,
"!"
];
class TestApp extends App.AppBase
{
function onStart() {
var p;
p = m.get("a");
Sys.println(p != null ? "Yay!" : "Bug!");
p = m.get("b");
Sys.println(p != null ? "Yay!" : "Bug!");
p = m.get("c");
Sys.println(p != null ? "Yay!" : "Bug!");
p = a[0];
Sys.println(p != null ? "Yay!" : "Bug!");
p = a[1];
Sys.println(p != null ? "Yay!" : "Bug!");
p = a[2];
Sys.println(p != null ? "Yay!" : "Bug!");
}
function onStop() {
}
function getInitialView() {
return [ new TestView() ];
}
}
When running the program, this is the output that I see...
Yay!
Bug!
Yay!
Yay!
Bug!
Yay!
I can avoid the bug by making a and m static members of a class. I haven't tried making them members of a module, but I'm thinking that would work as well.
Travis