This commit is contained in:
Alessandro Proto 2023-03-08 14:57:37 +01:00
parent d56a0d1a2a
commit 7628d4a29e
2 changed files with 5 additions and 19 deletions

View file

@ -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();

View file

@ -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);