I would like to call a function by its name. And possibly get list of all defined methods. For example:
fun loadDataAction(){...}
fun saveDataAction(){...}
...
val action = "saveData"
${{action + "Action"}}()
Is there a better way to do this than using when expression?
when (action){
"saveData" -> saveDataAction()
"loadData" -> loadDataAction()
...
else -> wrongAction()
}
It must work in javascript. So I can't use java reflection.