livecode


How to empty an array structure?


I have a very big array structure in livecode, like:
temp["A"]
temp["A"]["B"]
temp["A"]["B"]["c"]
temp["A"]["D"]
temp["A"]["D"]["E"][...]
...
I want to preserve the structure, but just put empty in the values.
What recursive procedure should I use?
I don't know how to pass arrays recursively.
I found my problem, I can't alter the same array that I'm travelling using repeat or recursive functions. I need to use 2 arrays, the second is the empty copy of the first. So this is the code:
function svuotaArray tarr
repeat for each key tKey in tArr
put empty into tArr2[tKey]
put svuotaArray(tArr[tkey]) into tArr2[tkey]
end repeat
return tArr2
end svuotaArray
Hmm... something like the following (untested) should work in current releases of LiveCode. I can't remember the release that added the ability to pass array elements by reference though:
command ClearElements #xArray
if xArray is an array then
repeat for each key tKey in xArray
ClearElements xArray[tKey]
end repeat
else
put empty into xArray
end if
end ClearElements
Max.
Something like this:
on mouseUp
repeat with y = 1 to 10
repeat with u = 1 to 10
put random(99) into myArray[u][y]
end repeat
end repeat
breakpoint--to see array
repeat with y = 1 to 10
repeat with u = 1 to 10
put "" into myArray[u][y]
end repeat
end repeat
end mouseUp

Related Links

Visual effect dissolve support desktop in Livecode?
How can I add a checkbox to a datagrid column
answer file dialog not recognizing cancel
How to find stack of Project Browser ? - livecode
How to filter list file with type image ? - Livecode
How to adding and append code on runtime ? - livecode
How to add CKEditor for input field ? - Livecode
How to create player and set autoplay with code at runtime?
How do smooth when scrolling group? - livecode
How to add custom options menu when Right Click on edit tool - Livecode
How do I join multiple words in LiveCode
How to upload file to a server with php - Livecode
native android scroller for 3-4 fields on 1 card does not work
specialFolderPath(“Users/myname”) is not working - Livecode
How to adding code to object at runtime ? - Livecode
How to import image by import as control at runtime in Livecode?

Categories

HOME
hpoo
openshift
orientdb
events
couchdb
swi-prolog
devexpress
nsview
cryptography
haxe
angular2-template
kurento
log4j2
amazon-emr
erd
graphdb
buffer
spring-amqp
outlook-restapi
max-msp-jitter
async-await
vertica
robolectric
nose
home
spring-ldap
password-generator
beego
javax.persistence
fatfs
d3.js-v4
premake
sca
om-next
cloudera-manager
subclassing
hidden-markov-models
export-to-pdf
grails3.2.0
robust
httphandler
julius-speech
react-intl
daz3d
jenkins-slave
adblock
line-intersection
kendo-treeview
annotatorjs
mifos
static-methods
swiffy
xcopy
textblock
django-validation
voronoi
phpquery
replicaset
dynamics-ax-2012-r2
ampersand
dbmigrate
webproject
quercus
comctl32
smacss
inequality
lmax
lumia-imaging-sdk
squeezebox
oxygene
roxy-fileman
cloo
pbkdf2
hints
axacropdf
significant-digits
daap
kolite
dynamic-c
boost-foreach
vows
net-use
anonymous-types
channelfactory
gaelyk
ios-4.2
mysqli-multi-query
google-translator-toolkit
3270
main-method
downcasting
chronic
service-factory

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile