string foo = "foo" + (true ? string("bar") : "bar");
string bar = "foo" + (false ? "bar" : string("bar"));
string foobar = "foo" + (true ? "bar" : "bar");
print(foo); // barbar
print(bar); // foobar
print(foobar); // foobar
The obviously-broken case here is the first one, which turns into "barbar". I wasn't able to reproduce this with integers or a simple script class with an opAdd method, so perhaps this is exclusive to the scriptstdstring addon?
Weird string behavior when using ?:
Encountered a weird behavior in string addition today on the latest SVN build:
Probably not a problem with the scriptstdstring add-on but rather a specific case for registered value types.
I'll investigate it and have it fixed as soon as possible.
Just ran into another string-related issue, perhaps it's related. The following never passes:
This seemed to have started happening after updating the WIP SVN version (we were already using the WIP version before but we were a little behind).
if (wButton.m_func == "scenario " + m_currentScenario.GetID())
Neither does this:string id = m_currentScenario.GetID();
if (wButton.m_func == "scenario " + id)
But this DOES pass:string id = "scenario " + m_currentScenario.GetID();
if (wButton.m_func == id)
Here, wButton.m_func is defined in scripts, and GetID() is a method registered by C++ with declaration "string GetID()".This seemed to have started happening after updating the WIP SVN version (we were already using the WIP version before but we were a little behind).
I've reproduced all the problems mentioned. I'll try to find the time to have them fixed at least by the end of this week.
I've fixed this now in revision 2368.
All of the scenarios were caused by the same bug. A temporary variable was being overwritten when invoking overloaded operators with left-to-right evaluation. This bug was introduced in the WIP itself. Good thing you identified the problem before I released the new version. :)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement