diff --git a/res/modules/internal/bytearray.lua b/res/modules/internal/bytearray.lua index 35bc6cc6..ab93cfea 100644 --- a/res/modules/internal/bytearray.lua +++ b/res/modules/internal/bytearray.lua @@ -166,11 +166,12 @@ local bytearray_mt = { end end } +bytearray_mt.__pairs = bytearray_mt.__ipairs local bytearray_type = FFI.metatype("bytearray_t", bytearray_mt) local FFIBytearray = { - __call = function (n) + __call = function (self, n) local t = type(n) if t == "string" then local buffer = malloc(#n) diff --git a/res/scripts/stdlib.lua b/res/scripts/stdlib.lua index f60242cd..3bc2147e 100644 --- a/res/scripts/stdlib.lua +++ b/res/scripts/stdlib.lua @@ -279,7 +279,7 @@ end local bytearray = require "core:internal/bytearray" Bytearray = bytearray.FFIBytearray Bytearray_as_string = bytearray.FFIBytearray_as_string -Bytearray_construct = Bytearray.__call +Bytearray_construct = function(...) return Bytearray(...) end ffi = nil math.randomseed(time.uptime() * 1536227939)