Thank you for your comments Edward, I always learn a lot with them.
I was concerned about pollution (I dont like to spread variables all over 
the place), so my plan was to put them in a new dictionary instead of 
directly in c:

c.FPRDict={}
> def myfunction():
>     g.es("hello")
> c.FPRDict["myfunc"]=myfunction


Is that also risky or would that be ok? All of my functions and vars etc 
will be contained under "FPRDict".


On Friday, September 20, 2013 9:42:39 AM UTC+2, Fidel N wrote:
>
> Hi: While I was preparing the question I came up with the answer. Im still 
> posting this because IMO its a very useful way of using the dictionary in 
> c.XXX, and I couldn't think of it before.
> This can be used instead of @command for creating functions that accept 
> arguments and are available in the current Leo file. I would include this 
> on the manuals/guides 
> here<http://leoeditor.com/scripting.html#the-g-command-decorator>, 
> since its short but gives an idea on how to make those functions quick and 
> easy. Or I would include it on the "Leo cheatsheet" document.
> Just put this into a node then run it:
>
> def MyFunction(string):
>>     g.es(string)
>> c.MyFunction=MyFunction   #We store the function in c
>> c.MyFunction("this works")
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to