Преглед изворни кода

[fixed] added safeguards and additional comment

anjuna krokus пре 1 месец
родитељ
комит
8b19c3b276
1 измењених фајлова са 8 додато и 3 уклоњено
  1. 8 3
      locations/shortgs.qsrc

+ 8 - 3
locations/shortgs.qsrc

@@ -1184,7 +1184,7 @@ if $ARGS[0] = 'color_is_dark':
 	killvar 'shortgs_cid_b'
 end
 
-!! func('shortgs', 'enumerate_list', '$arrname', {start}, {number}, {oxford_comma})
+!! func('shortgs', 'enumerate_list', '$arrname', {start}, {number}, ', ', ' and ', ', and ')
 !! returns a string with the array entries listed:
 !! $arr[0] = 'Sidisi'	-> returns: 'Sidisi'
 !! $arr[1] = 'Eriette'	-> returns: 'Sidisi and Eriette'
@@ -1195,16 +1195,21 @@ end
 !! $ARGS[4] is the small separator (defaults to ', ')
 !! $ARGS[5] is the final separator for 2 items (defaults to ' and ')
 !! $ARGS[6] is the final seperator for more items (defaults to ', and ')
+!!
+!! If you want to list the entries of an array, you can use
+!! func('shortgs', 'enumerate_list', '$arrname', 0, 0, '<br>', '<br>', '<br>')
+
+
 if $ARGS[0] = 'enumerate_list':
 	$temp_sgs_text = ''
 	$sgs_arrname = $ARGS[1]
 
-	if ARGS[2] = 0:
+	if ARGS[2] <= 0:
 		temp_sgs_i = 0
 	else
 		temp_sgs_i = ARGS[2]
 	end
-	if ARGS[3] = 0:
+	if ARGS[3] <= 0:
 		temp_sgs_max_i = arrsize($sgs_arrname)
 	else
 		temp_sgs_max_i = temp_sgs_i + ARGS[3]