Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buffer too small for table #10

Open
Jerakin opened this issue Nov 23, 2019 · 4 comments
Open

Buffer too small for table #10

Jerakin opened this issue Nov 23, 2019 · 4 comments

Comments

@Jerakin
Copy link

Jerakin commented Nov 23, 2019

/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
Copy link
Author

Jerakin commented Nov 23, 2019

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

@subsoap
Copy link
Owner

subsoap commented Nov 23, 2019

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.

@Jerakin
Copy link
Author

Jerakin commented Nov 14, 2020

Does sys.save allow for other userdata?

@subsoap
Copy link
Owner

subsoap commented Nov 14, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants