strong textI just begin to learn WarpScript. My task is to refactor a bigger code base. First i want to split large files into smaller junks (by concern/ function). But how to do this? I created a minimal example that is executed locally on docker based Warp10:
file mine.mc2 (an example of file/ macro that i want to call from other file):
<%
'greeting' STORE
$greeting
%> 'hello' STORE
'hello world' @hello
this is working and output is
["hello world"]
as expected
2nd file that should use the macro/ code from mine.mc2:
"hello world" @hello
but this isn't working:
Exception at '"hello world" =>@hello<=' in section [TOP] (Unknown macro 'hello')
i also tried @mine
, @/mine
here the error changes a bit to ('mine' is not a macro.)
.
So how to get this working?
And more general how to correctly include other files and reference the macros within? I want to have self contained code split into multiple files.
Edit or rephrase taking into account that everything is executed remotely:
Is there a way to implement code (in general multiple files with macros referencing mutually) quickly deploy it (all of it) and run it?
I found a solution that is specific to VSCode WarpScript plugin:
add
at the beginning of your code. this includes the reference macro - only if run within VSCode. For developing it might be enough.