PtokaX forum

Development Section => Your Developing Problems => Topic started by: jiten on 02 June, 2005, 22:10:36

Title: Horizontal Parser
Post by: jiten on 02 June, 2005, 22:10:36
Hi there fellas.
Got stuck with a Release bot function, so, decided to ask you guys for some hints, as I can't get to TGA (my ISP blocked all international hub connections).
I want to send a certain category's content to Main. But, sometimes that category has entries longer than 300 characters.
Here comes the problem: I pretend to parse that entry, so that the extra content (from the 145th character) appears in a new line and well tabbed (not distorted).
Here's mine and Dessamator's attempt:
local TimedMain = function(cat)
local msg = ""
msg = msg.."\r\n\r\n\t".." Category: "..cat.."\r\n\t"..string.rep("__",55).."\r\n\r\n\t? "
for i = 1, table.getn(Entry) do
if Entry[i] then
if string.lower(Entry[i][2]) == string.lower(cat) then
stuff = Entry[i][3]
while string.len(stuff) > 145 do
msg = msg..string.sub(stuff,1,145).."\r\n\t"
stuff  = string.sub(stuff,146,string.len(stuff))
end
msg = msg..stuff.."\r\n\t? "
end
end
end
msg = msg.."\r\n\t-- Your message here --\r\n\t"..string.rep("__",55).."\r\n"
return msg
end
SendToAll(TimedMain("cinemas"))

Best regards,

jiten
Title:
Post by: jiten on 03 June, 2005, 17:58:59
Hopefully we were able to sort this problem out :D
Anyway, thanks for your efforts.

Best regards