This project is read-only.

Extending prototype string

Jan 27, 2014 at 6:00 PM
Edited Jan 27, 2014 at 6:02 PM
Hello James,

suppose I would like to extend the String prototype, I would do that:
            engine.DynamicGlobalObject.String.prototype.contains = engine.CreateFunctionTemplate().GetFunctionObject(StringPrototype.contains);
The "contains" method is successfully invoked upon executing
"foobar".contains("foo");
But how do I fetch the actual string "foobar" from the variable "_this"?

"_this.AsString" as well as "(String)_this" only return "<object: StringObject>". I cannot cast it to "StringObject", because this class is not contained within the V8.Net and V8.Net.SharedTypes assemblies.

Thanks again & All the best
Philipp