Madmark's Modifications

From NaviWiki

Revision as of 12:52, 11 June 2007; view current revision
←Older revision | Newer revision→
Jump to: navigation, search

For the Navi Lua Wrapper to work, the following slight modifications need to be made:

In NaviData.h:

	// Hack By Mark Manyen to get access to the pair data for Lua
	void getMap(std::map<std::string,std::string> &out) const;

In NaviData.cpp:

void NaviData::getMap(std::map<std::string,std::string> &out) const
{
	std::string key, value;
	std::string mydataString = dataString;
	std::string::iterator it = mydataString.begin();
	while(it != mydataString.end())
	{
		key = "";
		while((*it) != '=')
		{
			key += (*it);
			++it;
		}
		++it;	//skip the '='
		value = "";
		while((it != mydataString.end()) && ((*it) != '&'))
		{
			value += (*it);
			++it;
		}

		out[key] = value;

		if(it != mydataString.end())
			++it; //skip the '&'
	}
}