Skip to content

Instantly share code, notes, and snippets.

@echicken
Created April 29, 2020 20:10
Show Gist options
  • Save echicken/7b1b8ff3fb133bdfd56b390b46c2ba59 to your computer and use it in GitHub Desktop.
Save echicken/7b1b8ff3fb133bdfd56b390b46c2ba59 to your computer and use it in GitHub Desktop.
thing
function strvar(fn, scope) {
if (scope === undefined) scope = js.scope;
const f = new File(fn);
if (!f.open('r')) throw 'nuh uh';
var txt = f.read();
f.close();
txt = txt.replace(/@strvar:(.*?)@/ig, function (m, p) {
return scope[p];
});
console.putmsg(txt);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment