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:
41
scripts/core/lua/LuaLiteralBoolean.js
Normal file
41
scripts/core/lua/LuaLiteralBoolean.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* @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),
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user