diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-03-20 16:13:17 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-03-20 16:13:17 -0300 |
commit | 5a04f1851e0d42b4bcbb0af103490bc964e985aa (patch) | |
tree | 227f98d4fff3f1bd1eea4d20ddd4aa0ec7562ddd /ltests.c | |
parent | 8c064fdc23bd745bbd3456a58cc9e2521f8e4263 (diff) | |
download | lua-5a04f1851e0d42b4bcbb0af103490bc964e985aa.tar.gz lua-5a04f1851e0d42b4bcbb0af103490bc964e985aa.tar.bz2 lua-5a04f1851e0d42b4bcbb0af103490bc964e985aa.zip |
New function 'luaL_makeseed'
This function unifies code from 'lua_newstate', 'math.randomseed',
and 'table.sort' that tries to create a value with a minimum level
of randomness.
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1159,7 +1159,7 @@ static int num2int (lua_State *L) { | |||
1159 | static int newstate (lua_State *L) { | 1159 | static int newstate (lua_State *L) { |
1160 | void *ud; | 1160 | void *ud; |
1161 | lua_Alloc f = lua_getallocf(L, &ud); | 1161 | lua_Alloc f = lua_getallocf(L, &ud); |
1162 | lua_State *L1 = lua_newstate(f, ud); | 1162 | lua_State *L1 = lua_newstate(f, ud, 0); |
1163 | if (L1) { | 1163 | if (L1) { |
1164 | lua_atpanic(L1, tpanic); | 1164 | lua_atpanic(L1, tpanic); |
1165 | lua_pushlightuserdata(L, L1); | 1165 | lua_pushlightuserdata(L, L1); |
@@ -1252,7 +1252,7 @@ static int checkpanic (lua_State *L) { | |||
1252 | lua_Alloc f = lua_getallocf(L, &ud); | 1252 | lua_Alloc f = lua_getallocf(L, &ud); |
1253 | b.paniccode = luaL_optstring(L, 2, ""); | 1253 | b.paniccode = luaL_optstring(L, 2, ""); |
1254 | b.L = L; | 1254 | b.L = L; |
1255 | L1 = lua_newstate(f, ud); /* create new state */ | 1255 | L1 = lua_newstate(f, ud, 0); /* create new state */ |
1256 | if (L1 == NULL) { /* error? */ | 1256 | if (L1 == NULL) { /* error? */ |
1257 | lua_pushnil(L); | 1257 | lua_pushnil(L); |
1258 | return 1; | 1258 | return 1; |