Can i convert a Table into Lua Code

i want to convert a table into a string of lua code. l have done this before using loops and string formatting but i was just wondering if there is a more elegant way of doing this from within lua. (this is for a plugin so i do have acess to the StudioService and Plugin object)

Hello, this is a bit vague. Please post your former code or elaborate more for help.

"{" .. table.concat({1, 2, 3}, ", ") .. "}"

This only works with tables that do not have automatic numbered indexes, otherwise I’m pretty sure you need a loop.

If I understood correctly, you want to make your text tables look “pretty”
image
Roblox doesn’t have any functions that would do that, string formatting is your friend.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.