I think this is not according to JS specification, example:
var a = {'test.test' : "blah"};
console.log(a['test.test']); // this works and splits "blah"
So there is no 100% true way to build path from the script. but if you want
there are two ways I can think of:
1. using regex
2. using 'some.path'.split('.') will give you two elements to play with.
(but you have to be more elaborate with longer paths)
In short, I think you are doing something wrong.. this is hacking basic
stuff that IMO you shouldnt..
On Thu, Dec 24, 2009 at 6:55 PM, Oskar Krawczyk <[email protected]>wrote:
> Yeah yeah, not Moo but Vanilla. I trust you guys more than any other JS
> group so I'll just go ahead ask here:
>
> http://www.mootools.net/shell/q5ngz/
>
> *There's a dynamic number of objects:*
>
> ScriptInfo = {
> version: '1.2'
> };
>
> AnotherScriptInfo = {};
> AnotherScriptInfo.Extension = {
> version: '1.2'
> };
>
> *And a config:*
>
> var classes = ['ScriptInfo', 'AnotherScriptInfo.Extension'];
>
> What I need is to get into: *window.NNN.version* - where *NNN* can be one
> property or 10.
>
> Of course doing *window['AnotherScriptInfo.Extension'].version* ain't
> gonna fly.
>
> How do I deal with this? It's probably simpler than any solution that comes
> to mind at this moment.
>
> ___
>
> Oskar Krawczyk
> http://nouincolor.com
>
--
---
"Make everything as simple as possible, but not simpler."
- Albert Einstein