defsave icon indicating copy to clipboard operation
defsave copied to clipboard

Buffer too small for table

Open Jerakin opened this issue 6 years ago • 4 comments

/defsave/defsave.lua:191: buffer (524280 bytes) too small for table

Maybe there could be an option for using io.* as Britzl mention on the forum

You could use json encoding for the table and normal io.* functions to load and save.

Jerakin avatar Nov 23 '19 12:11 Jerakin

Reproduced with pushing random data

local key = 1

local function callback(self, _, response)
    defsave.set("lorem", key, response.response)
    key = key + 1
end

function init(self)
    defsave.load("lorem")
    for i=1, 80 do
        http.request("https://baconipsum.com/api/?type=all-meat&paras=20&start-with-lorem=1", "GET", callback)
    end
end

Jerakin avatar Nov 23 '19 12:11 Jerakin

JSON (or other data types) is possible, the problem with any of that some types of userdata doesn't translate as far as I know.

subsoap avatar Nov 23 '19 18:11 subsoap

Does sys.save allow for other userdata?

Jerakin avatar Nov 14 '20 22:11 Jerakin

It has to be a table but if the userdata is a string it could be saved inside of a small table.

Internally, this function uses a workspace buffer sized output file sized 512kb. This size reflects the output file size which must not exceed this limit. Additionally, the total number of rows that any one table may contain is limited to 65536 (i.e. a 16 bit range). When tables are used to represent arrays, the values of keys are permitted to fall within a 32 bit range, supporting sparse arrays, however the limit on the total number of rows remains in effect.

subsoap avatar Nov 14 '20 23:11 subsoap