Expressions/Scripts/Presets

Moderator: Paul Tuersley

 
ajk48n
Topic Author
Posts: 19
Joined: Wed Jan 17, 2007 3:02 pm

Calling a function defined inside another function

Fri Feb 02, 2018 8:47 pm

I am trying to call a function that is defined inside another function. So say I have this:

function myFunc()
{
 
 function test()
 {
 alert("test');
 }
}


Is there any way to call test() without explicitly calling it inside of myFunc()?

For instance, I'd like to be able to call it like this:
myFunc().test()

or

myFunc.test()



But in any case, I always get an error saying test() is undefined. Does anyone know how to accomplish this?

My end goal is to expose a function within my script so that external scripts can access it directly.

Thanks

Who is online

Users browsing this forum: No registered users and 1 guest