1. RE: Type_check failure, game_name is {}
- Posted by Brian Broker <bkb at cnw.com> Oct 19, 2001
- 399 views
Hi, First, I was suggesting that you initialize 'game' from your file, so instead if putting this in your program: game = {0,{0,0,0,0,0,0,0,0,0,0,0},"","","",0} I suggested putting this in your file "gamestat.dat": {0,{0,0,0,0,0,0,0,0,0,0,0},"","","",0} (There is no need to initialize 'game' in your program if you are just going to overwrite it's value from your "gamestat.dat" file.) Now then, game[name] = game[5] which is an empty sequence ("" is the same as {}) (keep in mind that the constants you've defined are just for readability and/or making changes to your structure without having to adjust your entire program.) So you are declaring 'game_name' as an integer and are trying to assign an empty sequence to it. You should declare 'game_name' as a sequence but even that is a bit redundant because you could just use game[name] as it is. (I thought that was the whole point of creating a UDT out of a sequence...) i.e. menu_game1 = create( MenuItem, game[name], game_menu ... ) Hope this helps clear things up a bit... -- Brian timelord at zebra.net wrote: > Thanks Brian for the reply to my message 'Making UDT's using Sequence?' > I cutout then rewrote the code like in the reply message. > BUT, when I run it, the following message pops up > > Reva.exw:38 > Type_check failure, game_name is {} > > --> see ex.err > > I figured that game_name must of loaded as "" instead of "NAVGAP #19" > and the > problem is either in the open("filename", "r") or the use of the get() > command? > > fn = open( "gamestat.dat", "r" ) > or > get_game = get(fn) > > > ------------------------------ HERE IS THE CODE > ----------------------------------- > <snip>