ElementWrapper EventWrapper::GetCurrentElement() const
{
	ElementWrapper wrapper;
	wrapper.setElement(m_pEvent->GetCurrentElement());

	return wrapper;
}
void GlobalUtility::Set()
{
	Module::instance().getScriptInterface().PushDocumentTable(mVM, m_pDoc);
	SQRESULT sqr;

	if (m_pSelf)
	{
		ElementWrapper wrapper;
		wrapper.setElement(m_pSelf);

		//Add the global slot self
		sq_pushstring(mVM, "self", -1);
		sqr = sqb::Push<ElementWrapper>(mVM, wrapper);

		ROCKETSQUIRREL_ASSERT(SQ_SUCCEEDED(sqr));

		sqr = sq_newslot(mVM, -3, false);

		ROCKETSQUIRREL_ASSERT(SQ_SUCCEEDED(sqr));

		mSelfSet = true;
	}

	if (m_pEvt)
	{
		EventWrapper wrapper(m_pEvt);

		//Add the global slot event
		sq_pushstring(mVM, "event", -1);
		sqr = sqb::Push<EventWrapper>(mVM, wrapper);

		ROCKETSQUIRREL_ASSERT(SQ_SUCCEEDED(sqr));

		sqr = sq_newslot(mVM, -3, false);

		ROCKETSQUIRREL_ASSERT(SQ_SUCCEEDED(sqr));

		mEvtSet = true;
	}

	sq_poptop(mVM);
}