aboutsummaryrefslogtreecommitdiff
path: root/ltablib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-01-21 13:33:59 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2025-01-21 13:33:59 -0300
commit7d7ae8781e64e2b3b212d5c7b7c1b98b694df5ef (patch)
treea29433a8a29cd79ec3c8abc308c133e81d4259c6 /ltablib.c
parent724012d3d07f43f03451bb05d2bd9f55dff1d116 (diff)
downloadlua-7d7ae8781e64e2b3b212d5c7b7c1b98b694df5ef.tar.gz
lua-7d7ae8781e64e2b3b212d5c7b7c1b98b694df5ef.tar.bz2
lua-7d7ae8781e64e2b3b212d5c7b7c1b98b694df5ef.zip
Parameters for 'lua_createtable' back to int
Tables don't accept sizes larger than int.
Diffstat (limited to 'ltablib.c')
-rw-r--r--ltablib.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ltablib.c b/ltablib.c
index baa7111e..46ecb5e0 100644
--- a/ltablib.c
+++ b/ltablib.c
@@ -62,9 +62,9 @@ static void checktab (lua_State *L, int arg, int what) {
62static int tcreate (lua_State *L) { 62static int tcreate (lua_State *L) {
63 lua_Unsigned sizeseq = (lua_Unsigned)luaL_checkinteger(L, 1); 63 lua_Unsigned sizeseq = (lua_Unsigned)luaL_checkinteger(L, 1);
64 lua_Unsigned sizerest = (lua_Unsigned)luaL_optinteger(L, 2, 0); 64 lua_Unsigned sizerest = (lua_Unsigned)luaL_optinteger(L, 2, 0);
65 luaL_argcheck(L, sizeseq <= UINT_MAX, 1, "out of range"); 65 luaL_argcheck(L, sizeseq <= cast_uint(INT_MAX), 1, "out of range");
66 luaL_argcheck(L, sizerest <= UINT_MAX, 2, "out of range"); 66 luaL_argcheck(L, sizerest <= cast_uint(INT_MAX), 2, "out of range");
67 lua_createtable(L, (unsigned)sizeseq, (unsigned)sizerest); 67 lua_createtable(L, cast_int(sizeseq), cast_int(sizerest));
68 return 1; 68 return 1;
69} 69}
70 70
@@ -192,7 +192,7 @@ static int tconcat (lua_State *L) {
192static int tpack (lua_State *L) { 192static int tpack (lua_State *L) {
193 int i; 193 int i;
194 int n = lua_gettop(L); /* number of elements to pack */ 194 int n = lua_gettop(L); /* number of elements to pack */
195 lua_createtable(L, cast_uint(n), 1); /* create result table */ 195 lua_createtable(L, n, 1); /* create result table */
196 lua_insert(L, 1); /* put it at index 1 */ 196 lua_insert(L, 1); /* put it at index 1 */
197 for (i = n; i >= 1; i--) /* assign elements */ 197 for (i = n; i >= 1; i--) /* assign elements */
198 lua_seti(L, 1, i); 198 lua_seti(L, 1, i);