mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 10:46:06 +10:00
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.
This commit is contained in:
39
scripts/core/lua/LuaLiteralNumber.js
Normal file
39
scripts/core/lua/LuaLiteralNumber.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @typedef {import('./LuaLiteralTypes.js').LuaLiteralHandler} LuaLiteralHandler
|
||||
*/
|
||||
|
||||
/** @type {LuaLiteralHandler} */
|
||||
export const LuaLiteralNumber = {
|
||||
/**
|
||||
* @param {unknown} value
|
||||
* @returns {string}
|
||||
*/
|
||||
format(value) {
|
||||
const numeric = Number(value);
|
||||
return Number.isFinite(numeric) ? String(numeric) : "0";
|
||||
},
|
||||
|
||||
/** @returns {string} */
|
||||
defaultLiteral() {
|
||||
return "0";
|
||||
},
|
||||
|
||||
spawnableByDefault: true,
|
||||
|
||||
nodeModule: {
|
||||
definition: {
|
||||
id: "number_literal",
|
||||
title: "Number",
|
||||
category: "Values",
|
||||
description: "Constant numeric literal.",
|
||||
searchTags: ["number", "literal", "constant", "value"],
|
||||
inputs: [],
|
||||
outputs: [{ id: "value", name: "Value", direction: "output", kind: "number" }],
|
||||
properties: [{ key: "value", label: "Number", type: "number", defaultValue: 0 }],
|
||||
},
|
||||
behavior: {
|
||||
evaluateValue: ({ node, formatLiteral }) =>
|
||||
formatLiteral("number", node.properties.value ?? 0),
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user