View Single Post
12-08-05, 07:38 AM   #2
Elkano
A Flamescale Wyrmkin
 
Elkano's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2005
Posts: 131
You could try the following (I'm not sure it will work 'cause I haven't tested it, but I think it will):
Code:
function getparams(text) {
  _, _, match, match2 = string.find(text, "\"([^\"]+)\" \"([^\"]+)\"");
  if match ~= nil then return match;
  _, _, match, match2 = string.find(text, "\"([^\"]+)\" ([^\"]+)");
  if match ~= nil then return match;
  _, _, match, match2 = string.find(text, "([^\"]+) \"([^\"]+)\"");
  if match ~= nil then return match;
  _, _, match, match2 = string.find(text, "([^\"]+) ([^\"]+)");
  if match ~= nil then return match;
  retun nil;
}
Here is a link to the lua manual, where you may find other usefull information regarding pattern matching in lua (linked page and followups): http://www.lua.org/pil/20.html
  Reply With Quote