table output

Post Reply
herbert
Posts: 16
Joined: Mon May 11, 2015 4:47 pm

table output

Post by herbert »

at present I have a table which if I do

display(curing) it shows like

{
"apply epidermal to torso",
"smoke valerian"
}

and if I do


for name, aff in pairs(curing) do
send(aff.."###")
end

its sending each on its own line like

apply epidermal to torso###
smoke valerian###

how can I make it so it sends it like

apply epidermal to torso###smoke valerian###

or, isn't that doable?

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: table output

Post by Nyyrazzilyss »

I'd assume you'd do something like:

local temp=""

for name, aff in pairs(curing) do
temp = temp .. aff .. "###"
end

if temp ~= "" then
send(temp)
end

herbert
Posts: 16
Joined: Mon May 11, 2015 4:47 pm

Re: table output

Post by herbert »

but wont that send TEMP over and over again even if nothing is in it?

Nyyrazzilyss
Posts: 334
Joined: Thu Mar 05, 2015 2:53 am

Re: table output

Post by Nyyrazzilyss »

If nothing is in temp, it's going to equal ""

The if command prior to the send checks for that.

User avatar
Belgarath
Posts: 232
Joined: Fri Jul 26, 2013 7:19 am
Discord: macjabeth#7149

Re: table output

Post by Belgarath »

Code: [show] | [select all] lua
if #curing > 0 then
  send(table.concat(curing, "###"))
end

herbert
Posts: 16
Joined: Mon May 11, 2015 4:47 pm

Re: table output

Post by herbert »

Sorry I read it wrong .. (too many pain killers)

I was thinking the TEMP was CURING.. all working Thanks!

Now to try make it more 'prettier' for what its purpose iss :(

Post Reply