Re: Type_check failure, game_name is {}
- Posted by euman at bellsouth.net Oct 19, 2001
- 428 views
game = {0,{0,0,0,0,0,0,0,0,0,0,0},"","","name",0} -- is a sequence or game is {1, 2>{1,2,3,4,5,6,7,8,9,10,11}, 3, 4, 5, 6} integer game_name game_name = game[name] or game[5th position] -- you can not do this your saying game_name = "" where "" is a string or considered a sequence so, you have to do this game = {0,{0,0,0,0,0,0,0,0,0,0,0},"","","name",0} sequence game_name game_name = game[name] now game_name will be "name" just think of integers as numbers and strings as sequences but, sequences can contain both integers and strings but we'll leave that for another lesson. Reading the documentation that comes with Euphoria can help understand sequences. Euman euman at bellsouth.net ----- Original Message ----- From: <timelord at zebra.net> > 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 > ----------------------------------- > > include Win32Lib.ew > without warning > > constant x = 1, race = 2, trn = 3, rst = 4, name = 5, last = 6 > > sequence get_game, game > game = {0,{0,0,0,0,0,0,0,0,0,0,0},"","","",0} > integer fn > > fn = open( "gamestat.dat", "r" ) > get_game = get(fn) > if get_game[1] = GET_SUCCESS then > game = get_game[2] > end if > close(fn) > > integer game_name > game_name = game[name] > constant > Win = create( Window, "REVA", 0, 0, 0, 300, 200, 0 ), > game_menu = create( Menu, "&Games", Win, 0, 0, 0, 0, 0 ), > menu_game1 = create( MenuItem, game_name, game_menu, 0,0,0,0,0 ) > > WinMain(Win, Normal)