View Single Post
01-25-12, 01:23 PM   #1
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
some string help removing "'" or a '"'

Its been awhile and even looking at my own code i cant remember how to go about removing something from a string. I need to remove the " around the framename string variable so that it can be passed as a function name within the same function. Best way I can see to do this is to use a gsub? and ditch the "" around the framename by doing a local funcname = framename gsub or remove all together the " but i cant remember how that works lol.

This is the code as of right now you can see where im drawing blanks on the framename = part...
Code:
--[[-----------------------------------------------------------------------------
Individual Frames Creation
-------------------------------------------------------------------------------]]
local function DashFrameCreate(frametype, framename, frameparent, template, justify, texture, onenter)
	local frame = CreateFrame(frametype, framename, frameparent, template)
	frame:EnableMouse(true)
	frame:SetHeight(SIZE)
	frame:SetScript('OnLeave', addon.HideTooltip)
	frame.text = frame:CreateFontString(nil, 'OVERLAY', 'GameFontNormalSmall')
	frame.text:SetFont([[Fonts\FRIZQT__.TTF]], 12, 'NORMAL')
	if justify ~= nil then
		frame.text:SetJustifyH(justify)
	end
	if texture == true then
		frame.texture = frame:CreateTexture()
	end
	if frametype == 'Button' then
		frame:RegisterForClicks("AnyUp")
	end
	frame.text:SetPoint('RIGHT')
	frame.text:SetShadowOffset(1, -1)
	local funcname = framename 
	if onenter == true then
		frame:SetScript('OnEnter', funcname..'_OnEnter'(self))
	end
	return frame
end

DashFrameCreate('Frame',"GUI_DashMail", UIParent, nil, 'RIGHT', true, true)
DashFrameCreate('Button',"GUI_DashQuest", UIParent, nil, 'RIGHT', true, true)
DashFrameCreate('Button',"GUI_DashDurability", UIParent, nil, 'RIGHT', true)
DashFrameCreate('Button',"GUI_DashInventory", UIParent, 'SecureHandlerClickTemplate', 'RIGHT', true)
DashFrameCreate('Button',"GUI_DashMoney", UIParent, nil, nil, nil)
DashFrameCreate('Button',"clock", UIParent, nil, 'RIGHT', true)
DashFrameCreate('Frame',"GUI_DashLatency", UIParent, nil, 'RIGHT', nil)
DashFrameCreate('Frame',"GUI_DashFPS", UIParent, nil, 'RIGHT', nil)
DashFrameCreate('Button',"GUI_DashSocial", UIParent, 'SecureHandlerClickTemplate', 'RIGHT', true)
DashFrameCreate('Button', "GUI_DashGuild", UIParent, 'SecureHandlerClickTemplate', 'RIGHT', nil)
DashFrameCreate('Button',"GUI_DashSpeed", UIParent, nil, 'RIGHT', true)
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote