Display a 2d array

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jamtart
Posts: 4
Joined: Tue Oct 27, 2015 4:34 pm

Display a 2d array

Post by jamtart » Tue Oct 27, 2015 4:38 pm

I have been trying to display a 2d array in a table field. I've tried to combine my array in order to do this but I haven't found out how.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Display a 2d array

Post by FourthWorld » Tue Oct 27, 2015 5:04 pm

What does your "combine" statement look like?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: Display a 2d array

Post by dunbarx » Tue Oct 27, 2015 5:24 pm

Hi.

A table field cannot hold a two-dimensional array. It isn't, er, "big" enough. Just so I make sure I understand you, on a new card make a button and a table field. Put this into the button script:

Code: Select all

on mouseup
   put "" into fld 1
   repeat with y = 1 to 10 
      put 2 * y into tArray[y}
   end repeat
   combine tArray with return and tab
sort tArray numeric
   put tArray into  fld 1
end mouseup
This generates a list of ten numbers and their doubles, and loads them into a table field. But a two dimensional array has an extra layer, or dimension if you wish, and where would it "fit" into a table field?

Do I have any of this right?

Craig Newman

Post Reply