You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function ks_function
tcm_function(1)
end function
taskfunc tcm_function(param)
message(param)
end taskfunc
on init
tcm.init(10)
declare ui_switch switch
end on
on ui_control(switch)
ks_function
end on
Compile error: wrong number of parameters to tcm_function. 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.
The text was updated successfully, but these errors were encountered:
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.
mkruselj
changed the title
compile problem with taskfunc when declared before on init
Issue with inlined function calling a taskfunc with an argument
Mar 25, 2023
mkruselj
changed the title
Issue with inlined function calling a taskfunc with an argument
Issue with inlined function calling a taskfunc with an argument
Mar 25, 2023
Some code should explain it better:
Compile error: wrong number of parameters to tcm_function. 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.
The text was updated successfully, but these errors were encountered: