[PD] pdlua output

robcanning robcanning at eircom.net
Tue Jan 22 17:33:14 CET 2008


i'll clarify a bit...

i add a list to a table with:

-- "insert [list]" into 1st inlet:
function M:in_1_insert(list)
    table.insert(self.mydata, list)
end

then i search the table for the pattern "score = 1" and ask it to print 
the lines containing the matched pattern

-- what to do on "scores" into 1st inlet:
function M:in_1_scores()
for i, v in ipairs(self.mydata) do
if string.match(v, "score = 1", 1, true) then
self:outlet(1, "list", v) end
end
end

the problem is that the string.match is expecting a string and getting a 
table and i'm not sure how to fix this - i thought the ipairs was 
iterating the table into a string  but its not.

here is the error from pd:
[string "rob2"]:19: bad argument #1 to 'match' (string expected, got table)

lua and lua files attached

any guidance welcome,

thanks

rob c





-------------- next part --------------
A non-text attachment was scrubbed...
Name: rob2.lua
Type: text/x-lua
Size: 762 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20080122/e5f475b9/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: robsfirst.pd
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20080122/e5f475b9/attachment.asc>


More information about the Pd-list mailing list