From 7628d4a29ea0c12f3e2dd5cffc74e535b64c1179 Mon Sep 17 00:00:00 2001 From: Alessandro Proto Date: Wed, 8 Mar 2023 14:57:37 +0100 Subject: [PATCH] Cleanup --- Capy64/Runtime/Libraries/Machine.cs | 19 ------------------- Capy64/Runtime/Objects/Task.cs | 5 +++++ 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/Capy64/Runtime/Libraries/Machine.cs b/Capy64/Runtime/Libraries/Machine.cs index cc4d54f..6f8341e 100644 --- a/Capy64/Runtime/Libraries/Machine.cs +++ b/Capy64/Runtime/Libraries/Machine.cs @@ -72,11 +72,6 @@ public class Machine : IComponent name = "getClipboard", function = L_GetClipboard, }, - new() - { - name = "task", - function = L_Task, - }, new(), }; @@ -92,20 +87,6 @@ public class Machine : IComponent return 1; } - private static int L_Task(IntPtr state) - { - var L = Lua.FromIntPtr(state); - - var task = Objects.TaskMeta.Push(L, "test"); - task.Fulfill(lk => { - lk.NewTable(); - lk.PushString("value"); - lk.SetField(-2, "key"); - }); - - return 1; - } - private static int L_Shutdown(IntPtr _) { RuntimeManager.Shutdown(); diff --git a/Capy64/Runtime/Objects/Task.cs b/Capy64/Runtime/Objects/Task.cs index 946205f..27b2587 100644 --- a/Capy64/Runtime/Objects/Task.cs +++ b/Capy64/Runtime/Objects/Task.cs @@ -178,6 +178,11 @@ public class TaskMeta : IComponent public static RuntimeTask Push(Lua L, string typeName) { + if(!tasks.CheckStack(1)) + { + L.Error("tasks limit exceeded"); + } + var task = new RuntimeTask(typeName); ObjectManager.PushObject(L, task);