PDA

View Full Version : onDrop accessing parent scope



Phenome
November 24th, 2010, 13:37
This should probably be an easy task

I have a windowclass with an 'external' .lua script.
One of my windowcontrols is a drop target, and has an inline function like so:


function onDrop(x,y,dragdata)
(...)
end

I'd like to access my parent (windowclass) script scope, so I can call functions.

I tried DB.findNode('..') which even if it did find the node (and it doesn't), I probably wouldn't be able to access its functions. Any ideas? Thanks

Phenome
November 24th, 2010, 13:39
Nevermind :(

"A control has a variable called window pointing to the environment of the window's environment"

drahkar
November 29th, 2010, 16:31
Just wait till you start hard defining Global external scripts and then need to reference the window class. You have to remember to pass the information to the functions you make so it has a clue what you are talking about. :) That gets fun.

Phenome
November 29th, 2010, 19:40
Hahahahah that's sure something to look forward to!

I'm going through all sorts of trouble trying to modify the d20 ruleset...