[1.0.3] Dynamic Strings - ntoxin66/Dynamic GitHub Wiki

Dynamic isn't so dynamic when it comes to strings. The first time a string member is set, the length is defined for the lifetime of the member in the Dynamic instance.

Dynamic object as Dynamic();
object.SetString("someString", "someValue");

The above example sets the members length to 9. As a consiquence the members length is unable to change. Any further calls to set this member with a length larger than 9 will have the value truncated.

object.SetString("someString", "someValue123");

The above value "someValue123" will truncate to "someValue".

To resolve this limitation you should always parse the length paramater through any of the SetString functions on the first setter.

Below are the string setters from Dynamic's methodmap.


public DynamicOffset SetString(const char[] membername, const char[] value, int length=0)
public void SetStringByOffset(const DynamicOffset offset, const char[] value, int length=0)
public int PushString(const char[] value, int length=0, const char[] name="")

You might notice each of them has a length parameter. When this parameter is 0 the length is defined by the length of the value parameter. When the length parameter is set the string length is set according to the parameters value.

Dynamic object as Dynamic();
object.SetString("someString", "someValue", 128);

The above sets the members length to 128 which allows strings up to 128 charictors long before truncation occurs.

Next: Sharing Dynamic objects with multiple plugins