mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-01-18 18:46:43 +00:00
Cleanup
This commit is contained in:
parent
d56a0d1a2a
commit
7628d4a29e
2 changed files with 5 additions and 19 deletions
|
@ -72,11 +72,6 @@ public class Machine : IComponent
|
||||||
name = "getClipboard",
|
name = "getClipboard",
|
||||||
function = L_GetClipboard,
|
function = L_GetClipboard,
|
||||||
},
|
},
|
||||||
new()
|
|
||||||
{
|
|
||||||
name = "task",
|
|
||||||
function = L_Task,
|
|
||||||
},
|
|
||||||
new(),
|
new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -92,20 +87,6 @@ public class Machine : IComponent
|
||||||
return 1;
|
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 _)
|
private static int L_Shutdown(IntPtr _)
|
||||||
{
|
{
|
||||||
RuntimeManager.Shutdown();
|
RuntimeManager.Shutdown();
|
||||||
|
|
|
@ -178,6 +178,11 @@ public class TaskMeta : IComponent
|
||||||
|
|
||||||
public static RuntimeTask Push(Lua L, string typeName)
|
public static RuntimeTask Push(Lua L, string typeName)
|
||||||
{
|
{
|
||||||
|
if(!tasks.CheckStack(1))
|
||||||
|
{
|
||||||
|
L.Error("tasks limit exceeded");
|
||||||
|
}
|
||||||
|
|
||||||
var task = new RuntimeTask(typeName);
|
var task = new RuntimeTask(typeName);
|
||||||
|
|
||||||
ObjectManager.PushObject(L, task);
|
ObjectManager.PushObject(L, task);
|
||||||
|
|
Loading…
Reference in a new issue