mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-01-18 10:36:44 +00:00
Remove native event.pull and event.pullRaw
This commit is contained in:
parent
e152203afd
commit
74b799a0b4
2 changed files with 3 additions and 55 deletions
|
@ -37,16 +37,6 @@ public class EventLib : IComponent
|
|||
|
||||
private static readonly LuaRegister[] Library = new LuaRegister[]
|
||||
{
|
||||
new()
|
||||
{
|
||||
name = "pull",
|
||||
function = L_Pull,
|
||||
},
|
||||
new()
|
||||
{
|
||||
name = "pullRaw",
|
||||
function = L_PullRaw
|
||||
},
|
||||
new()
|
||||
{
|
||||
name = "push",
|
||||
|
@ -92,50 +82,6 @@ public class EventLib : IComponent
|
|||
return 1;
|
||||
}
|
||||
|
||||
private static int LK_Pull(IntPtr state, int status, IntPtr ctx)
|
||||
{
|
||||
var L = Lua.FromIntPtr(state);
|
||||
|
||||
if (L.ToString(1) == "interrupt")
|
||||
{
|
||||
L.Error("interrupt");
|
||||
}
|
||||
|
||||
var nargs = L.GetTop();
|
||||
|
||||
return nargs;
|
||||
}
|
||||
|
||||
public static int L_Pull(IntPtr state)
|
||||
{
|
||||
var L = Lua.FromIntPtr(state);
|
||||
|
||||
var nargs = L.GetTop();
|
||||
for (int i = 1; i <= nargs; i++)
|
||||
{
|
||||
L.CheckString(i);
|
||||
}
|
||||
|
||||
L.YieldK(nargs, 0, LK_Pull);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static int L_PullRaw(IntPtr state)
|
||||
{
|
||||
var L = Lua.FromIntPtr(state);
|
||||
|
||||
var nargs = L.GetTop();
|
||||
for (int i = 1; i <= nargs; i++)
|
||||
{
|
||||
L.CheckString(i);
|
||||
}
|
||||
|
||||
L.Yield(nargs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static int L_Push(IntPtr state)
|
||||
{
|
||||
var L = Lua.FromIntPtr(state);
|
||||
|
|
|
@ -255,7 +255,9 @@ public class TaskMeta : IComponent
|
|||
|
||||
private static void WaitForTask(Lua L)
|
||||
{
|
||||
L.PushCFunction(Libraries.EventLib.L_Pull);
|
||||
L.PushString("coroutine");
|
||||
L.GetTable(-1);
|
||||
L.GetField(-1, "yield");
|
||||
L.PushString("task_finish");
|
||||
L.CallK(1, 4, 0, LK_Await);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue