[PD] Spell checking / existence of a word

Nicolas Montgermont nicolas_montgermont at yahoo.fr
Wed Jul 16 12:26:48 CEST 2008


Hi Frank,

Frank Barknecht a écrit :
> Hallo,
>
> You could use Lua instead. It's like [shell] on steroids, if you
> employ something like "io.popen" like this:
>
>  word = get_word_from_inlet()
>  cmd = "aspell -c " .. word
>  p = assert(io.popen(cmd))
>  result = p:read("*all")
>
> Lua is trivial to build on OS-X. I just did it and I'm a complete OS-X
> idiot. Here's how: You check out pdlua from goto10 subversion, edit
> Makefile.static to let it find m_pd.h and build for OS-X ("PLATFORM =
> macosx"), then do "make -f Makefile.static" while connected to the net
> to let make download and build Lua for you and that's it. OS-X seems
> to come with everything needed.
>
> Ciao
>   
pdlua compile and load well here I think, console says:

lua 0.5 (GPL) 2008 Claude Heiland-Allen <claudiusmaximus at goto10.org>
lua: compiled for pd-0.40 on Jul 16 2008 11:41:16

After that I wrote a little pd_luax object called lspell.pd_luax and 
containing:

local LSpell = pd.Class:new():register("lspell")

function LSpell:initialize(name, atoms)
    self.outlets = 1
    self.inlets = 1
    return true
end

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.
When I do :

[symbol toto(
|
[lspell]

pd prints:

received :toto
error: lua: error in dispatcher:
[string "lspell.pd_luax"]:14: attempt to call global 
'get_word_from_inlet' (a nil value)

I have no really idea of the way pdlua manage functions and everything. 
Must I dig more into the pd_lua examples or is this only a lua problem I 
can handle if searching universal lua docs?

Thanks for your answers,

Nicolas
-- 
http://nim.on.free.fr




More information about the Pd-list mailing list