If then else matters! - I5 12600KF, Asus Tuf GT501, Gigabyte Gaming OC 16G 5080 RTX, Asus Tuf Gaming H670 Pro, 48GB, Corsair RM850X PSU, SN850 1TB, Arctic Liquid Freezer 280, ASUS RT-AX1800U router
Je moet bij je eval nog de 'var ' zetten.XLerator schreef op 01 januari 2003 @ 18:40:
Dus dat, als ik een instrument in het array erbij plaats, ik meteen een variabele heb met die naam.
Maar dat wil niet, maar dan heb je een idee van wat ik wil.
Is dit mogelijk en zo ja, hoe?
dus
1
2
3
4
| for (x=0;x<instumenten.length;x++) { eval( "var " + instrumenten[x] ) = new Sound( instrumenten[x] ); } |
zou moeten werken.
[ Voor 43% gewijzigd door edie op 01-01-2003 18:53 ]
"In America, consumption equals jobs. In these days, banks aren't lending us the money we need to buy the things we don't need to create the jobs we need to pay back the loans we can't afford." - Stephen Colbert
If then else matters! - I5 12600KF, Asus Tuf GT501, Gigabyte Gaming OC 16G 5080 RTX, Asus Tuf Gaming H670 Pro, 48GB, Corsair RM850X PSU, SN850 1TB, Arctic Liquid Freezer 280, ASUS RT-AX1800U router
1
| eval( "var " + instrumenten[x] + " = new Sound( '" + instrumenten[x] + "' )" ); |
"In America, consumption equals jobs. In these days, banks aren't lending us the money we need to buy the things we don't need to create the jobs we need to pay back the loans we can't afford." - Stephen Colbert
Maar ik heb het al, het is set Variabele.
Dus set (varname, value)
Dus ik heb het antwoord al
edit
Alsnog bedankt he Eddie
[ Voor 9% gewijzigd door Guillome op 01-01-2003 19:57 ]
If then else matters! - I5 12600KF, Asus Tuf GT501, Gigabyte Gaming OC 16G 5080 RTX, Asus Tuf Gaming H670 Pro, 48GB, Corsair RM850X PSU, SN850 1TB, Arctic Liquid Freezer 280, ASUS RT-AX1800U router