How to create a button in each table row that pass its row data to other function

hi,

i want to create a table in which each row have a string and a onclick button.
by clicking button that row string pass to other function.
im using lua and html and basic javascript

any idea how to do this?