ID:162640
 
Is there anyway to quickly turn a one item list into a variable?
This is the code i've got:
ProductSupply.Copy(Position,Position+1)

This is how im using in my code
        var/NewPrice = (NewDemand/(NewGovern+(ProductSupply.Copy(Position,Position+1)))+rand(-10,10))

Im doing something like this a couple hundred times in the code, and an easy way to change the return into a variable so it doesn't return "/list" would be great, any ideas?
To reference an index of a list, you do this:

var/myVar = someList[1]


That will set myVar to the first entry in someList. If the list is only going to be 1 entry long, why use a list in the first place?
In response to Volte
I'm certainly no expert in lists, but from what I understand, when you copy item(s) out of a list using Copy() it creates a second list. Which is not favorable, so the 1 item list is the result of copying 1 item out of that list and separating it, I'm hoping to be able to take that one item from the list and turn it into a variable I can use.

Thanks for the quick response and the working solution, hopefully I can add that to my code easily. I would have never thought of that.