Forgive me if I re-format that so I can see it better:
function init()
return {
posters: {
home: mainposters
}
posterlists: {
home: posters.home
}
}
end function
There is no posters variable at the point you are doing this assignment. That happens later. During the assignment, it's generating an anonymous data structure, and after it's created, assigning it to a variable (or in this case returning it).
In the case of
function init()
return {
posters: {
home: mainposters
}
posterlists: {
home: m.posters
}
}
end function
You are getting invalid because you haven't assigned anything to m.posters
at the point of the assignment, which is when this is evaluated. Similar to above (you may have an
m with this data later, but not at this point from this function alone.
What you have here is a bit of a chicken and egg problem. Try this:
function init()
data = {
posters: {
home: mainposters
}
}
' Point posterlists to the same AA in data.posters
data.posterlists = data.posters ' data.posters already exists from above
return data
end function
-- GandK Labs
Check out Reversi! in the channel store!