Files
picoGraph/scripts/core/lua/LuaLiteralString.js
Max Litruv Boonzaayer f917cf6ad5 Add initial Pico-8 cartridges for testing
- Created test_cart.p8 with basic drawing functionality and a print statement.
- Created test_unix.p8 with a simple initialization function.
2026-03-21 18:38:43 +11:00

39 lines
954 B
JavaScript

/**
* @typedef {import('./LuaLiteralTypes.js').LuaLiteralHandler} LuaLiteralHandler
*/
/** @type {LuaLiteralHandler} */
export const LuaLiteralString = {
/**
* @param {unknown} value
* @returns {string}
*/
format(value) {
return JSON.stringify(String(value ?? ""));
},
/** @returns {string} */
defaultLiteral() {
return '""';
},
spawnableByDefault: true,
nodeModule: {
definition: {
id: "string_literal",
title: "String",
category: "Values",
description: "Constant string literal.",
searchTags: ["string", "literal", "text", "value"],
inputs: [],
outputs: [{ id: "value", name: "Value", direction: "output", kind: "string" }],
properties: [{ key: "value", label: "Text", type: "string", defaultValue: "hello" }],
},
behavior: {
evaluateValue: ({ node, formatLiteral }) =>
formatLiteral("string", node.properties.value ?? ""),
},
},
};