ok im trying to create a few functions to make the work with structs more simple and allow to redefine them on the fly, add vars, remove vars, ect..
now i ran into a bit of a snag with this as i wanted to pass a global struct to local scope with variable struct name(s).. take a look
a = 0 ,
b = 13
fn structAddVar str var2Add val2Add Name:"" isGlobal:false =
local propNames = getPropNames str
local temp = str()
local props = for prop in propNames collect getProperty temp prop
local stri = ""
stri += "struct "+ (if classOf name == string then name else "conStructorTempStr") + " \n"
stri += "("+"\n"
for i = 1 to propNames.count do
stri += propNames[i] as string + " = " + props[i] as string + ",\n"
stri += var2Add as string + " = " + val2Add as string + "\n"
stri += ")"+"\n"
local tStruct = copy conStructorTempStr --problem :P how in the world am i supposed to get it into a local scope with variable name ?!
if not isGlobal do execute (if classOf name == string then name else "conStructorTempStr" + " = undefined")
)--END structAddVar FN
structAddVar struct1 #c 27 Name:"theTestStruct"
as you see everything works fine if i only have the one preDefined name for the structs.. but thats not the point of the whole thing so my question is: how would i go about getting that struct into a local scope with a changing (var) name?
thx for you time