Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6406afc

Browse files
Update ltablib.c
Added import for lua standard libraries: base (tostring(), `tonumber(), etc.) math table (insert(), sort(), remove(), ...) string (len(), match(), ...) Replaced print() function with the original version modified with Serial
1 parent d4b7988 commit 6406afc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

‎src/lua/ltablib.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,14 @@ typedef unsigned int IdxT;
256256
** is to copy them to an array of a known type and use the array values.
257257
*/
258258
static unsigned int l_randomizePivot (void) {
259-
clock_t c = clock();
259+
// clock_t c = clock();
260260
time_t t = time(NULL);
261-
unsigned int buff[sof(c) + sof(t)];
261+
// unsigned int buff[sof(c) + sof(t)];
262+
unsigned int buff[sof(t)];
262263
unsigned int i, rnd = 0;
263-
memcpy(buff, &c, sof(c) * sizeof(unsigned int));
264-
memcpy(buff + sof(c), &t, sof(t) * sizeof(unsigned int));
264+
// memcpy(buff, &c, sof(c) * sizeof(unsigned int));
265+
// memcpy(buff + sof(c), &t, sof(t) * sizeof(unsigned int));
266+
memcpy(buff, &t, sof(t) * sizeof(unsigned int));
265267
for (i = 0; i < sof(buff); i++)
266268
rnd += buff[i];
267269
return rnd;
@@ -440,6 +442,7 @@ static const luaL_Reg tab_funcs[] = {
440442

441443
LUAMOD_API int luaopen_table (lua_State *L) {
442444
luaL_newlib(L, tab_funcs);
445+
lua_setglobal(L, "table");
443446
#if defined(LUA_COMPAT_UNPACK)
444447
/* _G.unpack = table.unpack */
445448
lua_getfield(L, -1, "unpack");

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /