Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » U++ Esc Interpreter, Esc Macros and templates » How to add global var to Esc from cpp-files?
Re: How to add global var to Esc from cpp-files? [message #25530 is a reply to message #25527] Sun, 28 February 2010 00:04 Go to previous message
Sc0rch is currently offline  Sc0rch
Messages: 99
Registered: February 2008
Location: Russia, Rubtsovsk
Member

dolik.rce wrote on Sun, 28 February 2010 04:09


PS: I haven't tested the code, just extracted it from my older project... Hope it works.

Hello, Honza!

It works. I've created a function for it:
bool SetGlobalVar(ArrayMap<String, EscValue>& global, const String& var,
	const String& param, const String& value)
{
	Vector<EscValue> args;
	try {
		Scan(global, "SetGlobalVar(){:" + var + (param.IsEmpty() ? "" : "[\"") + param
			+ (param.IsEmpty() ? "" : "\"]") + "=" + value + ";}");

		Execute(global, NULL, global.Get("SetGlobalVar"), args);
		global.Remove(global.Find("SetGlobalVar"));
	}
	catch(CParser::Error e)
	{
		LOG("ERROR: " + e);
		return false;
	}

	return true;
}


Thanks for support!
Anton.
 
Read Message
Read Message
Read Message
Previous Topic: Problem with script translation
Next Topic: Creating classes for Esc and using in Esc.
Goto Forum:
  


Current Time: Mon Aug 25 13:44:48 CEST 2025

Total time taken to generate the page: 0.05455 seconds