[Gambas-user] Searching a key in the array of gb.settings
Doriano Blengino
doriano.blengino at ...1909...
Sat Nov 8 12:11:51 CET 2008
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...
> 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; 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.
More info if you want...
Cheers,
Doriano
More information about the User
mailing list