Hello guys! I have an issue to call function from another class. I know I'm doing something wrong here but I have no clue what.. so, any advises would be highly appreciated. I have this class called "Tools" where I'm trying to store functions needed often. However when calling the function to load settings simulator crashes with error "Error: Unexpected Type Error"
import Toybox.Graphics; import Toybox.WatchUi; import Toybox.Application; import Toybox.Lang; using Toybox.Time.Gregorian; var toolsInstance; class Tools { function initialize() { toolsInstance = new Tools(); } public function medNames() as Array<String> { // fetch settings var medNames = new Array<String>[15]; for (var i=0; i <= 14; i++) { medNames[i]= Properties.getValue("MedName"+i).toString(); } System.println("Do we even come here?"); return medNames; } }
This is how I try to call it from another class:
var medNames = new Array<String>[15]; medNames = toolsInstance.medNames();