You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# add value to an array
array push myArray one
# %myArray = one
array push myArray two
# %myArray = one|two# remove last value
array pop myArray
# %myArray = one# get number of elements in arrayeval count array count myArray
# %count = 1# index into array# %myArray[0] = one# %myArray(0) = one# remove a value at an index
var myArray one|two|three
array removeAt 1 myArray
# %myArray = one|three
var myArray one|two|three
eval item array first myArray
eval item array lowest myArray
# %item = one
var myArray one|two|three
eval item array last myArray
eval item array highest myArray
# %item = three
array slice??
array splice??# When sort compares two values, it sends the values to the compare function,# and sorts the values according to the returned (negative, zero, positive) value.
var myArray Enchanting|Alchemy|Engineering
array sort myArray sortAsc
array sort myArray sortDesc
sortAsc:
var targetArray $1
var itemA $2
var itemB $3
var indexA $4
var indexB $5# expects -1 < 0 < 1 to sortreturn %itemA.LearningRate - %itemB.LearningRate
sortDesc:
var targetArray $1
var itemA $2
var itemB $3
var indexA $4
var indexB $5# expects -1 < 0 < 1 to sortreturn %itemB.LearningRate - %itemA.LearningRate
The text was updated successfully, but these errors were encountered:
A few suggestions:
1) POPAT instead of REMOVEAT (just makes more sense since the other “get something out” command is also POP
2) POP and POPAT should populate a variable (pick one, a variable that we can’t normally mess with, or allow ARRAY POP myArray myVar)
3) I still would love %myArray[0] to give the whole array. That way I can access the whole array without knowing the entire length of the list.
I know 3’s a stretch since you programmer guys like to start counting at 0, so I’m happy to give that up :D
~~Daniel
On Apr 6, 2017, at 7:24 PM, Joe McBride ***@***.***> wrote:
Idea for a new script command: array
# add value to an array
array push myArray one
# %myArray = one
array push myArray two
# %myArray = one|two
array pop myArray
# %myArray = one
eval count array count myArray
# %count = 1
# %myArray[0] = one
# %myArray(0) = one
var myArray one|two|three
array removeAt 1 myArray
# %myArray = one|three
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <https://github.com/joemcbride/outlander-osx/issues/127>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AXv5wq4licwFMY359y3GuH6DJR9K2r7Fks5rtXQegaJpZM4M2SSM>.
Idea for a new script command:
array
The text was updated successfully, but these errors were encountered: