[PD] Spell checking / existence of a word

Frank Barknecht fbar at footils.org
Wed Jul 16 16:53:39 CEST 2008

Nicolas Montgermont hat gesagt: // Nicolas Montgermont wrote:

> function LSpell:in_1_symbol(s)
>     pd.post("received :" .. s)
>     word = get_word_from_inlet()
>     cmd = "aspell -c " .. word
>     p = assert(io.popen(cmd))
>     result = p:read("*all")
> end
> I know there is no output yet but the code is bugging at the 
> get_word_from_inlet() function.

Yeah, sorry, that's probably my fault. My little Lua example was meant
to be a kind of pseudo-code, sorry. But I see that you already solved
the issue with Claude's help.

Btw. other than in Python or C, variables are global as default in Lua.
I also didn't include it in my "pseudo-code"  but instead of this:

>     cmd = "aspell -c " .. word
>     p = assert(io.popen(cmd))
>     result = p:read("*all")

you should declare variables as "local" like this: 

 local cmd = "aspell -c " .. word
 local p = assert(io.popen(cmd))
 local result = p:read("*all")

Sorry for adding confusion like this.


More information about the Pd-list mailing list