Thread Tools Display Modes
Prev Previous Post   Next Post Next
03-28-09, 11:36 AM   #1
jadakren
A Flamescale Wyrmkin
 
jadakren's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2007
Posts: 103
tagstrings & editing of them

Regarding tagstrings,

I assume that it's not possible to return the contents of a function as a string?

idea i have is to edit tags and the functions that drive them, but in order to do this it seems I would need to provide them as strings and somehow execute them with loadstring.

ideas?

Code:
oUF.Tag["[name]"] = function(u)
 local func = "UnitName(u)"
 return u~=nil and loadstring(func) or func
end
I assume this would allow me to continue using the tagstring normally. But it would also allow me access to the function generating the output value, since i have such an approach for an ingame editor to obtain the internals for this tag :

Code:
function config:GetTagOptions(tag)
 local funcString = oUF.Tag[tag] or nil
 return (funcString~=nil and tostring(funcString())) or 'error'
end
function config:SetTagOptions(tag,funcData)
 oUF.Tags[tag] = function(u) 
  local func = funcData.func
  return loadstring(func)
 end
end
Here we suppose some kind of ingame editor is told to change the way the tagstring '[name]' behaves so that it makes names lowercase :
Code:
oUF.SetTagOptions('[name]',{func = 'UnitName(u):lower()'})
any ideas or thoughts to make this idea better/workable/more efficient or just maybe any kind of thoughts you have?
  Reply With Quote
 

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » tagstrings & editing of them


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off