RagingGam0r

Remove comments from LUA script

Oct 15th, 2020
1,420
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # -*- coding: utf-8 -*-
  2.  
  3. test = "bruh--[[ comment ]] lol"
  4. NewText = ""
  5. IsComment = False
  6. for i,v in enumerate(test):
  7.   if (str(test[i:i+1]) == "-") and (str(test[i+1:i+2]) == "-"):
  8.     IsComment = True
  9.   elif (str(test[i-2:i-1]) == "]") and (str(test[i-1:i]) == "]"):
  10.     IsComment = False
  11.   if IsComment == False:
  12.     NewText = NewText + str(v)
  13.  
  14. print(NewText)
  15.  
  16.  
RAW Paste Data