mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-25 03:06:05 +10:00
Initial commit
moved from private version control
This commit is contained in:
38
scripts/nodes/library/lua/coroutineCreate.js
Normal file
38
scripts/nodes/library/lua/coroutineCreate.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import { createNodeModule } from "../../nodeTypes.js";
|
||||
|
||||
/**
|
||||
* Creates a coroutine from a function using coroutine.create().
|
||||
*/
|
||||
export const luaCoroutineCreateNode = createNodeModule(
|
||||
{
|
||||
id: "lua_coroutine_create",
|
||||
title: "Coroutine Create",
|
||||
category: "Lua",
|
||||
description: "Wrap a function in a coroutine via coroutine.create().",
|
||||
searchTags: ["coroutine", "create", "lua"],
|
||||
inputs: [
|
||||
{
|
||||
id: "fn",
|
||||
name: "Function",
|
||||
direction: "input",
|
||||
kind: "any",
|
||||
description: "Function to run inside the coroutine",
|
||||
},
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
id: "coroutine",
|
||||
name: "Coroutine",
|
||||
direction: "output",
|
||||
kind: "any",
|
||||
},
|
||||
],
|
||||
properties: [],
|
||||
},
|
||||
{
|
||||
evaluateValue: ({ resolveValueInput }) => {
|
||||
const fn = resolveValueInput("fn", "function() end");
|
||||
return `coroutine.create(${fn})`;
|
||||
},
|
||||
}
|
||||
);
|
||||
Reference in New Issue
Block a user