mirror of
https://github.com/Ale32bit/Capy64.git
synced 2025-01-18 18:46:43 +00:00
Added GC functions to handles
This commit is contained in:
parent
79c232a4ac
commit
916662bebd
4 changed files with 40 additions and 0 deletions
|
@ -40,6 +40,16 @@ public class BinaryReadHandle : IHandle
|
||||||
if (newTable)
|
if (newTable)
|
||||||
L.NewTable();
|
L.NewTable();
|
||||||
|
|
||||||
|
// metatable
|
||||||
|
L.NewTable();
|
||||||
|
L.PushString("__close");
|
||||||
|
L.PushCFunction(L_Close);
|
||||||
|
L.SetTable(-3);
|
||||||
|
L.PushString("__gc");
|
||||||
|
L.PushCFunction(L_Close);
|
||||||
|
L.SetTable(-3);
|
||||||
|
L.SetMetaTable(-2);
|
||||||
|
|
||||||
foreach (var pair in functions)
|
foreach (var pair in functions)
|
||||||
{
|
{
|
||||||
L.PushString(pair.Key);
|
L.PushString(pair.Key);
|
||||||
|
|
|
@ -40,6 +40,16 @@ public class BinaryWriteHandle : IHandle
|
||||||
if (newTable)
|
if (newTable)
|
||||||
L.NewTable();
|
L.NewTable();
|
||||||
|
|
||||||
|
// metatable
|
||||||
|
L.NewTable();
|
||||||
|
L.PushString("__close");
|
||||||
|
L.PushCFunction(L_Close);
|
||||||
|
L.SetTable(-3);
|
||||||
|
L.PushString("__gc");
|
||||||
|
L.PushCFunction(L_Close);
|
||||||
|
L.SetTable(-3);
|
||||||
|
L.SetMetaTable(-2);
|
||||||
|
|
||||||
foreach (var pair in functions)
|
foreach (var pair in functions)
|
||||||
{
|
{
|
||||||
L.PushString(pair.Key);
|
L.PushString(pair.Key);
|
||||||
|
|
|
@ -27,6 +27,16 @@ public class ReadHandle : IHandle
|
||||||
if (newTable)
|
if (newTable)
|
||||||
L.NewTable();
|
L.NewTable();
|
||||||
|
|
||||||
|
// metatable
|
||||||
|
L.NewTable();
|
||||||
|
L.PushString("__close");
|
||||||
|
L.PushCFunction(L_Close);
|
||||||
|
L.SetTable(-3);
|
||||||
|
L.PushString("__gc");
|
||||||
|
L.PushCFunction(L_Close);
|
||||||
|
L.SetTable(-3);
|
||||||
|
L.SetMetaTable(-2);
|
||||||
|
|
||||||
foreach (var pair in functions)
|
foreach (var pair in functions)
|
||||||
{
|
{
|
||||||
L.PushString(pair.Key);
|
L.PushString(pair.Key);
|
||||||
|
|
|
@ -32,6 +32,16 @@ public class WriteHandle : IHandle
|
||||||
if (newTable)
|
if (newTable)
|
||||||
L.NewTable();
|
L.NewTable();
|
||||||
|
|
||||||
|
// metatable
|
||||||
|
L.NewTable();
|
||||||
|
L.PushString("__close");
|
||||||
|
L.PushCFunction(L_Close);
|
||||||
|
L.SetTable(-3);
|
||||||
|
L.PushString("__gc");
|
||||||
|
L.PushCFunction(L_Close);
|
||||||
|
L.SetTable(-3);
|
||||||
|
L.SetMetaTable(-2);
|
||||||
|
|
||||||
foreach (var pair in functions)
|
foreach (var pair in functions)
|
||||||
{
|
{
|
||||||
L.PushString(pair.Key);
|
L.PushString(pair.Key);
|
||||||
|
|
Loading…
Reference in a new issue