Files
picoGraph/scripts/nodes/library/table/pairs.js
Max Litruv Boonzaayer e64f3e881e Initial commit
moved from private version control
2025-10-19 21:12:41 +11:00

26 lines
755 B
JavaScript

import { createNodeModule } from "../../nodeTypes.js";
/**
* Produces a key-value iterator using PICO-8's pairs helper.
*/
export const tablePairsNode = createNodeModule(
{
id: "table_pairs",
title: "Pairs Iterator",
category: "Tables",
description: "Create an iterator yielding key-value pairs for a table.",
searchTags: ["pairs", "table", "iterator", "loop"],
inputs: [{ id: "table", name: "Table", direction: "input", kind: "table" }],
outputs: [
{ id: "iterator", name: "Iterator", direction: "output", kind: "any" },
],
properties: [],
},
{
evaluateValue: ({ resolveValueInput }) => {
const tableValue = resolveValueInput("table", "{}");
return `pairs(${tableValue})`;
},
}
);