Open ghost opened 6 years ago
I think tcm.init() needs to be defined in ICB before a taskfunc is defined, so what you did above is throwing the compiler off.
By the way, you should be using a macro in your example rather than a function (for ks_function). Then it works.
Technically, this should not create an error. I will leave this issue open; in the meantime, I recommend always including functions after the init callback. We manage a lot of large projects and this isn't an issue for us, the main idea is to create a "build file" that assembles all your callbacks and functions as imported macros from other imported files. This lets you write code the way you desire in other files, while assembling it in a more standard order for the compilation order.
To clarify, this is now possible, because tcm.init() was just improved in the latest versions of SublimeKSP to support tcm.init() in imported files.
Some code should explain it better:
Compile error: _wrong number of parameters to tcmfunction. Expected 1, got 0 works if you 'call' ks_function. Works if the functions are declared after 'on init' and after 'on ui_control(switch). So why not do that? Because it's a bit messy and it might affect larger projects.