Heya guys,
I have been working on my panel for quite a bit now and I’m no programmer so any time I’ve hit a brick wall I’ve just come here for the answers, now progress is coming along but I’m going back over things to tidy up a lot since there are a lot of methods and a lot of messy coding and obsolete code. One thing that I’m unsure how to do that would help with this a lot is – throughout my methods I have “utility” functions (at least thats how I’ll refer to them – nothing to do with the utility features etc in Ctrlr) that are used all over the place in different methods, I just copy and paste them into each script that needs to use it.
What I’m looking for is how I can have the function declared in one place that I can access from each of my methods without having to have it written out in every other script…Kind of like how in c++ you would have a header file with functions, variables, etc and just #include to reference the functions from it…this stems from just a general lack of understanding of Lua & Ctrlr, (and to an extent programming in general – still pretty n00b).
for example I have a function for decoding patch/program dumps used in a few places, where ideally I’d have it declared in one file:
-- utility functions method
function decodeDump(patchData)
--my function code
end
then
-- Load patch data method
function loadPatchData()
local patchData = {FO, 00, .. F7}
local decodedData = decodeDump(patchData)
end
I assume this is pretty easily doable as it took me an age to realize that I can access non local variables from any method by simply…typing out the variable name. So yeah, any help is appreciated – probably something very obvious or easy to find elsewhere but this forum has proved super helpful so far so it’s pretty much my go to atm.
Cheers.