Author Topic: Horizontal Parser  (Read 1186 times)

0 Members and 1 Guest are viewing this topic.

Offline jiten

  • Scripter
  • Forum Legend
  • ******
  • Posts: 1 577
  • Karma: +71/-5
Horizontal Parser
« 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:
Code: [Select]
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
« Last Edit: 02 June, 2005, 22:11:44 by jiten »

PtokaX forum

Horizontal Parser
« on: 02 June, 2005, 22:10:36 »

Offline jiten

  • Scripter
  • Forum Legend
  • ******
  • Posts: 1 577
  • Karma: +71/-5
(No subject)
« Reply #1 on: 03 June, 2005, 17:58:59 »
Hopefully we were able to sort this problem out :D
Anyway, thanks for your efforts.

Best regards

PtokaX forum

(No subject)
« Reply #1 on: 03 June, 2005, 17:58:59 »