Insert table as part of the email

Hello
what I need to achieve is the table inside the html string to be send through native.showPopup(“mail”)
I need something like this in the letter:

  1. value1
  2. value2
  3. value3
    When I display a table like this on the screen I use a combination of loops to display a table. However I can’t come up with the way to insert this sort of the table into html string. I tried turning a table to Json and then stripping it off brackets and quotes, but string.gsub doesn’t work with square brackets.

Do you have any ideas how to do this? 

you’d have to show a more complete example of what you want your output to look like for a “complete” answer, but regarding “string.gsub doesn’t work with square brackets” – yes it does, you just need to escape brackets like “%[” so they’re not treated as a special pattern characters

string.gsub() works with all characters.  Don’t worry.  I didn’t understand the rules of string parsing in Lua at first either.

Try this:

local bob = "[[hello]]" print(bob) bob = string.gsub( bob, "%[", "" ) bob = string.gsub( bob, "%]", "" ) print( bob )

This will print:

[[hello]] hello

Great! thank you everybody.
I didn’t know about this method to avoid special characters.

toInsert2 = string.gsub( toInsert, '%["', ' ' ) 

I have thus implemented a sequence of gsub and reached my goal.
 

you’d have to show a more complete example of what you want your output to look like for a “complete” answer, but regarding “string.gsub doesn’t work with square brackets” – yes it does, you just need to escape brackets like “%[” so they’re not treated as a special pattern characters

string.gsub() works with all characters.  Don’t worry.  I didn’t understand the rules of string parsing in Lua at first either.

Try this:

local bob = "[[hello]]" print(bob) bob = string.gsub( bob, "%[", "" ) bob = string.gsub( bob, "%]", "" ) print( bob )

This will print:

[[hello]] hello

Great! thank you everybody.
I didn’t know about this method to avoid special characters.

toInsert2 = string.gsub( toInsert, '%["', ' ' ) 

I have thus implemented a sequence of gsub and reached my goal.