How can i edit an object in an array
4 posts • Page 1 of 1
How can i edit an object in an array
a=[0,0,0,0,0];a(0)=1;a returns still [0,0,0,0,0]
- l4m2
- Posts: 42
- Joined: Fri Jun 27, 2014 6:21 am
Re: How can i edit an object in an array
you could only re-create an array (or write function to do it).
also there is some tricks like this:
a := [0,0,0,0,0];
a = a * [1,1,0,1,1] + [0,0,1,0,0] * b
also there is some tricks like this:
a := [0,0,0,0,0];
a = a * [1,1,0,1,1] + [0,0,1,0,0] * b
Dream of Algodoo as game development engine...
-

Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: How can i edit an object in an array
Kilinich wrote:you could only re-create an array (or write function to do it).
also there is some tricks like this:
a := [0,0,0,0,0];
a = a * [1,1,0,1,1] + [0,0,1,0,0] * b
Byt what if some other things(for example,strings) existed?
setv=(a,i,d){z="";for(string.length(a),(j)=>{z=z+(j>0?",":"")+(i==j?"d":"a("+j+")")});z}
is said Bad index in list.
Of course,if succeed we have to evaluate(eval) it.
- l4m2
- Posts: 42
- Joined: Fri Jun 27, 2014 6:21 am
Re: How can i edit an object in an array
setv=(a,i,d)=>{z="[";for(string.length(a),(j)=>{z=z+(j>0?",":"")+(i==j?"d":"a("+j+")")});eval(z+"]")}
I mistook thyme again....
I mistook thyme again....
- l4m2
- Posts: 42
- Joined: Fri Jun 27, 2014 6:21 am
4 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 6 guests



