OnlineCheater Posted February 4, 2016 Posted February 4, 2016 Hey all, I actually wonder how to remove a piece of text, I'm gonna give you examples: For example I want to show a list of maps, those maps contain tags and i want to remove those tags only from the whole name. I know it's a string.gsub or something, another string maybe, I don't remember and that's why I'm asking you. Well, for exemple those mapnames: "/ABC/ Mapname1" "/DEF/ Mapname2" "/OEHSHE/ Mapname3" "/HSIUXOP/ Mapname4" So here is my question, how to remove those tags between / /, should I create a table with all the tags and then do something like tableName = {"/ABC/", "/DEF/", "/OEHSHE/", "/HSIUXOP/"} for i, v in pairs(tableName) do if string.find(mapname, "v") then mapname = mapname:string.gsub(v, "") end end That's all I wanted to know, thanks in advance! My nickname ingame: B#Crackz~ Do NOT ask me for help via PM about anything related to scripting. There are forums for that.
ViRuZGamiing Posted February 4, 2016 Posted February 4, 2016 where is mapname defined if you reach line 4? "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
OnlineCheater Posted February 4, 2016 Author Posted February 4, 2016 where is mapname defined if you reach line 4? Mapname is like those 4 examples which I wrote before the code. Do you understand it ? My nickname ingame: B#Crackz~ Do NOT ask me for help via PM about anything related to scripting. There are forums for that.
ViRuZGamiing Posted February 4, 2016 Posted February 4, 2016 No I don't understand but you could just add this to your code if I'm correct. string.gsub(v, "/", "") Argument 1 is the string, 2 is what pattern (what to find), 3 what to make the pattern (in this case nothing) "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
OnlineCheater Posted February 4, 2016 Author Posted February 4, 2016 Alright else the way of removing the tags should work right? Gonna test it tomorrow My nickname ingame: B#Crackz~ Do NOT ask me for help via PM about anything related to scripting. There are forums for that.
ViRuZGamiing Posted February 4, 2016 Posted February 4, 2016 Alrightelse the way of removing the tags should work right? Gonna test it tomorrow What I would do tho is this; local maps = {"/ABC/", "/DEF/", "/OEHSHE/", "/HSIUXOP/"} for i, v in pairs(maps) do maps[i] = string.gsub(v, "/", "") end Since I guess the default names aren't needed anymore. "If debugging is the process of removing software bugs, then programming must be the process of putting them in."
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now