diff --git a/Capy64/Runtime/Objects/FileHandle.cs b/Capy64/Runtime/Objects/FileHandle.cs index ffabbca..07a12cc 100644 --- a/Capy64/Runtime/Objects/FileHandle.cs +++ b/Capy64/Runtime/Objects/FileHandle.cs @@ -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 @@ private static int L_Close(IntPtr state) 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 @@ private static unsafe int F_ToString(IntPtr state) return 1; } - private static int F_GC(IntPtr state) + private static int LM_GC(IntPtr state) { var L = Lua.FromIntPtr(state); diff --git a/Capy64/Runtime/Objects/GPUBuffer.cs b/Capy64/Runtime/Objects/GPUBuffer.cs index ddbf6e7..07f95a3 100644 --- a/Capy64/Runtime/Objects/GPUBuffer.cs +++ b/Capy64/Runtime/Objects/GPUBuffer.cs @@ -59,13 +59,11 @@ public static void CreateMeta(Lua L) public static uint[] ToBuffer(Lua L, bool gc = false) { return ObjectManager.ToObject(L, 1, gc); - //return L.CheckObject(1, ObjectType, gc); } public static uint[] CheckBuffer(Lua L, bool gc = false) { var obj = ObjectManager.CheckObject(L, 1, ObjectType, gc); - //var obj = L.CheckObject(1, ObjectType, gc); if (obj is null) { L.Error("attempt to use a closed buffer"); @@ -164,14 +162,18 @@ private static int LM_Length(IntPtr state) 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; } }