Skip to content

Lua 5.5 support: better seed for lua_newstate#328

Merged
thegushi merged 1 commit into
trusteddomainproject:developfrom
futatuki:lua55-newstate-seed
May 25, 2026
Merged

Lua 5.5 support: better seed for lua_newstate#328
thegushi merged 1 commit into
trusteddomainproject:developfrom
futatuki:lua55-newstate-seed

Conversation

@futatuki
Copy link
Copy Markdown

In Lua 5.5.0, it introduce 3rd parameter seed for lua_newstate()[1]. It is used for the seed of randomness for the hashing of strings in new lua state returned by lua_newstate(). Lua 5.5.0 also provides a wrapper function 'luaL_newstate()[2] to use lua_newstate()easly and it usesluaL_makeseed(NULL) for calling 'lua_newstate(). So we also use it for seeds instead of 0.

[1] https://www.lua.org/manual/5.5/manual.html#lua_newstate
[2] https://www.lua.org/manual/5.5/manual.html#luaL_newstate

In Lua 5.5.0, it introduce 3rd parameter `seed` for `lua_newstate()`[1].
It is used for the seed of randomness for the hashing of strings
in new lua state returned by `lua_newstate()`.  Lua 5.5.0 also
provides a wrapper function 'luaL_newstate()`[2] to use `lua_newstate()`
easly and it uses `luaL_makeseed(NULL)` for calling 'lua_newstate()`.
So we also use it for seeds instead of `0`.

[1] https://www.lua.org/manual/5.5/manual.html#lua_newstate
[2] https://www.lua.org/manual/5.5/manual.html#luaL_newstate
@thegushi thegushi merged commit 223a931 into trusteddomainproject:develop May 25, 2026
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

Successfully merging this pull request may close these issues.

2 participants