I've search for this but couldn't find a suitable answer.

Basically I'm making a new plugin, and I'm using the format from this site:


However, I am having trouble with variable scope (or maybe I'm doing it the wrong way).

If I have this (truncated so it's easier to read):
Code JavaScript:
	$.rp_popup = { 'version' : "0.0.1" };
	$.fn.rp_popup = function(options)
		var $element = $(this);
		var options = $.extend({}, $.rp_popup.defaults, options);
			return false;
	$.rp_popup.open_popup = function()
                // I want to access options here
	$.rp_popup.defaults = {
		modal		: false	

Ignore the fact the plugin does nothing

How can I access options from the open_popup function? I know I can put it inside the rp_popup function but that seems a little hacky (although this is the way pretty photo does it).

And jquery UI does it in a way where you pass a function as a string, and then uses eval to call it, so:
Code JavaScript:
but I'm not sure about that.

So yea, sorry for the long post, but what's the best way to do it?

Cheers in advance