lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


  Hi. I need help. 
  Lua is case-sensitive, and I know that. 

  But when I allow users to modify scripts, most complaints turn out
  to be issues like "Function" and "End" in user-modified scripts.   

  To make things more robust, this came to my mind: 

   * Exploit the fact that all lua keywords and libs are lowercase. 
   * Make all my exports to lua_state also lowercase 
   * Preprocess script in lua, making everything lowercase
 
  But I need to skip string literals. Eg:

  PRINT("Mr \"Hyde") -> change PRINT to print, but skip "Mr \"Hyde" 
  Print[[Dady]]      ->  -   //  -                 skip Dady 
  ...
   
  Is there a way to gsub() and get everythig in lua script except 
  string literals? 

  Did I miss something else in this approach?