[Gambas-user] Searching a key in the array of gb.settings

gambas at ...1938... gambas at ...1938...
Sat Nov 8 22:36:53 CET 2008


Am Samstag, 8. November 2008 12:11:51 schrieb Doriano Blengino:
> gambas at ...1938... ha scritto:
> > There is just another thing with gb.settings.
> >
> > Let's say, the user entered a number on his keypad, which is registered
> > in my seetings.file and associated with the action:
> > "SunIsShinigOpenRoofOFCarAndHaveAFunnyRide" :-)
> >
> > Print (hCFG["Action/" & sItem])
> > Ouput: SunIsShinigOpenRoofOFCarAndHaveAFunnyRide
> >
> > Just for fun:
> > Action = hCFG["Action/" & sItem]
> > Print (Action)
> > Ouput: SunIsShinigOpenRoofOFCarAndHaveAFunnyRide
>
> What type the variable Action has? Should be string...
It is string!

> > Calling this function with
> > hCFG["Action/" & sItem]()
> > or
> > Action() 'is the same as above, I know
> >
> > compiles fine, but when executing the programm, I get:
> > MMain.?.0: #12: Not an object
> >
> > Any ideas?? ...sitting in front of my code with many many "?" in my face.
> > :-)
>
> What you are trying to do could only work in true interpreted languages
> - perhaps; 
That's the answer why it works in Perl! :whistle:

> it is a total non-sense in every serious programming language. 
> Gambas is a serious language, so it can not do what you (erroneously)
> expect. But gambas is not innocent - it lets you to compile non-senses...
>
> The error "Not an object" is right: you tried to call a string - which
> is not an object.
Message understood!! ...it's not so easy to release a perl-behavior. ;-)

But I'm still lost in the dark.
How can I check, if the user entered a valid option of my servicemenu 
(settingsfile)?

TIA
Greetz
Stevie






More information about the User mailing list