Page 1 of 1

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

Posted: Wed Jul 29, 2020 2:36 pm
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

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

Posted: Wed Jul 29, 2020 2:39 pm
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.

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

Posted: Wed Jul 29, 2020 5:05 pm
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)

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

Posted: Wed Jul 29, 2020 5:10 pm
by demonnic
add a display(chartables) before the table.concat call. also check for errors in the error view

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

Posted: Wed Jul 29, 2020 8:26 pm
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.