How would you go about removing comments from this
local scr = [[
local t = "hello world" -- cool
local f = "world hello" -- removing comments
]]
print(scr) --outcome (supposed to be) local t = "hello world"local f = "worldhello"
instead of //--\\ local t = "hello world" -- cool
local f = "world hello" -- removing comments
I tried using string.gsub but also failed, also couldn't find any articles to help me
people are saying this is a solution, but I'm trying to make this
comment_symbols = "--"
s1 = [[
"cool" -- lol
"man"
]]
print ( string.match( s1, "[^"..comment_symbols.."]+" ) ) -- outputs cool
im trying to make this output "cool man" instead of just "cool"

4 comments
Are you talking about the comments highlighted in green or variables?
green
I think ctrl + f can find and replace stuff in a script. So just put in -- or [[/]] and replace it with nothing
I think .gsub is too weak for this, regex would work perfectly fine but regex itself is bigger than Lua itself. Either you can implement 4000 lines of regex yourself, or ignore them.