mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 10:46:06 +10:00
Initial commit
moved from private version control
This commit is contained in:
36
scripts/nodes/library/system/save.js
Normal file
36
scripts/nodes/library/system/save.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import { createNodeModule } from "../../nodeTypes.js";
|
||||
|
||||
/**
|
||||
* Persists the active cartridge to disk.
|
||||
*/
|
||||
export const saveNode = createNodeModule(
|
||||
{
|
||||
id: "system_save",
|
||||
title: "Save Cartridge",
|
||||
category: "System",
|
||||
description: "Save the current cartridge to the specified filename.",
|
||||
searchTags: ["save", "cartridge", "system", "cart"],
|
||||
inputs: [
|
||||
{ id: "exec_in", name: "Exec", direction: "input", kind: "exec" },
|
||||
{
|
||||
id: "filename",
|
||||
name: "Filename",
|
||||
direction: "input",
|
||||
kind: "string",
|
||||
defaultValue: "cart.p8",
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{ id: "exec_out", name: "Exec", direction: "output", kind: "exec" },
|
||||
],
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
emitExec: ({ indent, indentLevel, resolveValueInput, emitNextExec }) => {
|
||||
const filename = resolveValueInput("filename", '""');
|
||||
const lines = [`${indent(indentLevel)}save(${filename})`];
|
||||
lines.push(...emitNextExec("exec_out"));
|
||||
return lines;
|
||||
},
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user