table.concat .. Am I doin i 'rong' ??

Post Reply
breakone9r
Posts: 24
Joined: Sun Jul 26, 2020 1:39 am

table.concat .. Am I doin i 'rong' ??

Post by breakone9r »

Code: Select all

function mm_mapper()
  chartables = gmcp.char.status
  tablestring = table.concat(chartables)
  echo(tablestring)
end
I have a populated roomtables variable, but tablestring variable is completely devoid of any strings.

what am I doing wrong here? I'm trying to teach myself both lua and gmcp here. LOL
Last edited by breakone9r on Wed Jul 29, 2020 5:05 pm, edited 1 time in total.

User avatar
demonnic
Posts: 699
Joined: Sat Dec 05, 2009 3:19 pm

Re: table.concat .. Am I doin i 'rong' ??

Post by demonnic »

I don't see where chartables is set in the code above. I find it's best to give table.concat the separator to use to glue the table together as well. so table.concat(chartables, ",") to glue it with commas, table.concat(chartables, " ") for spaces, etc.

breakone9r
Posts: 24
Joined: Sun Jul 26, 2020 1:39 am

Re: table.concat .. Am I doin i 'rong' ??

Post by breakone9r »

yeah. I just typed it in wrong... fixin it here. (it's right in the client, i just pasted the wrong one here)

User avatar
demonnic
Posts: 699
Joined: Sat Dec 05, 2009 3:19 pm

Re: table.concat .. Am I doin i 'rong' ??

Post by demonnic »

add a display(chartables) before the table.concat call. also check for errors in the error view

breakone9r
Posts: 24
Joined: Sun Jul 26, 2020 1:39 am

Re: table.concat .. Am I doin i 'rong' ??

Post by breakone9r »

Well. display shows it, but concat still doesnt do anything? I'm probably using it wrong. I'll fiddle with it some more.

Thank you very much for the help.

Post Reply