File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -1413,7 +1413,11 @@ static int luv_spawn(lua_State* L) {
14131413 stdio [2 ].data .stream = (uv_stream_t * )stderr_pipe ;
14141414
14151415 /* Parse the args array */
1416+ #if LUA_VERSION_NUM >= 502
1417+ size_t argc = lua_rawlen (L , 2 ) + 1 ;
1418+ #else
14161419 size_t argc = lua_objlen (L , 2 ) + 1 ;
1420+ #endif
14171421 char * * args = malloc ((argc + 1 ) * sizeof (char * ));
14181422 args [0 ] = strdup (command );
14191423 size_t i ;
@@ -1435,7 +1439,11 @@ static int luv_spawn(lua_State* L) {
14351439 lua_getfield (L , 3 , "env" );
14361440 env = NULL ;
14371441 if (lua_type (L , -1 ) == LUA_TTABLE ) {
1442+ #if LUA_VERSION_NUM >= 502
1443+ argc = lua_rawlen (L , -1 );
1444+ #else
14381445 argc = lua_objlen (L , -1 );
1446+ #endif
14391447 env = malloc ((argc + 1 ) * sizeof (char * ));
14401448 for (i = 0 ; i < argc ; i ++ ) {
14411449 lua_rawgeti (L , -1 , i + 1 );
You can’t perform that action at this time.
0 commit comments