mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-01-18 10:36:44 +00:00
Rename Metatable functions
This commit is contained in:
parent
5dddc42910
commit
f9f56c8063
2 changed files with 15 additions and 13 deletions
|
@ -57,17 +57,17 @@ public class FileHandle : IPlugin
|
|||
new()
|
||||
{
|
||||
name = "__gc",
|
||||
function = F_GC,
|
||||
function = LM_GC,
|
||||
},
|
||||
new()
|
||||
{
|
||||
name = "__close",
|
||||
function = F_GC,
|
||||
function = LM_GC,
|
||||
},
|
||||
new()
|
||||
{
|
||||
name = "__tostring",
|
||||
function = F_ToString,
|
||||
function = LM_ToString,
|
||||
},
|
||||
|
||||
new(),
|
||||
|
@ -307,7 +307,7 @@ public class FileHandle : IPlugin
|
|||
return 0;
|
||||
}
|
||||
|
||||
private static unsafe int F_ToString(IntPtr state)
|
||||
private static unsafe int LM_ToString(IntPtr state)
|
||||
{
|
||||
var L = Lua.FromIntPtr(state);
|
||||
var stream = ToStream(L);
|
||||
|
@ -322,7 +322,7 @@ public class FileHandle : IPlugin
|
|||
return 1;
|
||||
}
|
||||
|
||||
private static int F_GC(IntPtr state)
|
||||
private static int LM_GC(IntPtr state)
|
||||
{
|
||||
var L = Lua.FromIntPtr(state);
|
||||
|
||||
|
|
|
@ -59,13 +59,11 @@ public class GPUBuffer : IPlugin
|
|||
public static uint[] ToBuffer(Lua L, bool gc = false)
|
||||
{
|
||||
return ObjectManager.ToObject<uint[]>(L, 1, gc);
|
||||
//return L.CheckObject<uint[]>(1, ObjectType, gc);
|
||||
}
|
||||
|
||||
public static uint[] CheckBuffer(Lua L, bool gc = false)
|
||||
{
|
||||
var obj = ObjectManager.CheckObject<uint[]>(L, 1, ObjectType, gc);
|
||||
//var obj = L.CheckObject<uint[]>(1, ObjectType, gc);
|
||||
if (obj is null)
|
||||
{
|
||||
L.Error("attempt to use a closed buffer");
|
||||
|
@ -164,14 +162,18 @@ public class GPUBuffer : IPlugin
|
|||
return 1;
|
||||
}
|
||||
|
||||
private static int LM_ToString(IntPtr state)
|
||||
private static unsafe int LM_ToString(IntPtr state)
|
||||
{
|
||||
var L = Lua.FromIntPtr(state);
|
||||
|
||||
var buffer = CheckBuffer(L, false);
|
||||
|
||||
L.PushString(ObjectType);
|
||||
|
||||
var buffer = ToBuffer(L);
|
||||
if (buffer is not null)
|
||||
{
|
||||
L.PushString("GPUBuffer ({0:X})", (ulong)&buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
L.PushString("GPUBuffer (closed)");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue