Re: Live Tutoria?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Lynn Kilroy wrote:
>
> So ... to begin with, how would the Include File be formatted?  And how
> would the call be made?  There would be no need to pass an argument to
> function Inkey, as it only returns results: A key from the keyboard buffer.=
> 
> 
> >function Inkey
> >?
> >end function

Well, the get_key() routine does the exact same thing as Inkey$ (most BASIC
routines have Euphoria equivalents). If you have a file and you want to have
stuff that's declared in it exported to other programs you just need to preceed
the declaration with "global". So for Inkey() it would be:

-- [Declared in file Inkey.e]
global function Inkey()
    return get_key()
end function

then in some other code after you include the file and you can use Inkey()
freely.

include Inkey.e

integer char
char = 0 

-- Print the pressed key until Q is hit
while char != 'q' do
    char = Inkey()
    ? char
end while


The Euphoria Standard Library project :
    http://esl.sourceforge.net/
The Euphoria Standard Library mailing list :
    https://lists.sourceforge.net/lists/listinfo/esl-discussion

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu