mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 02:36:04 +10:00
- Created test_cart.p8 with basic drawing functionality and a print statement. - Created test_unix.p8 with a simple initialization function.
42 lines
1.0 KiB
JavaScript
42 lines
1.0 KiB
JavaScript
/**
|
|
* @typedef {import('./LuaLiteralTypes.js').LuaLiteralHandler} LuaLiteralHandler
|
|
*/
|
|
|
|
/** @type {LuaLiteralHandler} */
|
|
export const LuaLiteralBoolean = {
|
|
/**
|
|
* @param {unknown} value
|
|
* @returns {string}
|
|
*/
|
|
format(value) {
|
|
if (typeof value === "string") {
|
|
return value === "false" ? "false" : "true";
|
|
}
|
|
return value ? "true" : "false";
|
|
},
|
|
|
|
/** @returns {string} */
|
|
defaultLiteral() {
|
|
return "false";
|
|
},
|
|
|
|
spawnableByDefault: true,
|
|
|
|
nodeModule: {
|
|
definition: {
|
|
id: "boolean_literal",
|
|
title: "Boolean",
|
|
category: "Values",
|
|
description: "Constant boolean literal.",
|
|
searchTags: ["boolean", "literal", "true", "false"],
|
|
inputs: [],
|
|
outputs: [{ id: "value", name: "Value", direction: "output", kind: "boolean" }],
|
|
properties: [{ key: "value", label: "Value", type: "boolean", defaultValue: true }],
|
|
},
|
|
behavior: {
|
|
evaluateValue: ({ node, formatLiteral }) =>
|
|
formatLiteral("boolean", node.properties.value ?? true),
|
|
},
|
|
},
|
|
};
|