This commit is contained in:
2024-11-15 10:32:19 +08:00
parent c1df659af4
commit e1528c41bb
35 changed files with 6343 additions and 62 deletions

View File

@@ -8,7 +8,7 @@
class Memory {
function alloc(Size) {
return NativePointer(Size);
return NativePointer(Size.tostring());
}
function allocUtf8String(Str) {
@@ -22,11 +22,13 @@ class NativePointer {
constructor(T) {
if (type(T) == "integer") {
C_Object = Sq_New_Point(T);
//注册销毁伪析构
Register_Destruction(C_Object, this);
C_Object = L_sq_I2P(T);
} else if (type(T) == "userdata") {
C_Object = T;
} else if (type(T) == "string") {
C_Object = Sq_New_Point(T.tointeger());
//注册销毁伪析构
Register_Destruction(C_Object, this);
}
}
@@ -115,9 +117,6 @@ class NativePointer {
function read(type) {
local Buf = Sq_Point2Blob(L_sq_P2I(this.C_Object), 4);
foreach(value in Buf) {
print(value);
}
return Buf.readn(type);
}