in Javascript:
obj = Midi.tag();
Console.log(obj[0]); // this prints "undefined"
So I get undefined when I try to do this which leads me to believe there may be a way to add something in the C++ code that tells it how to handle brackets ‘[]’? How do I do it? Thanks! (Note the class within a class below) I guess the question is specifically: What do I add to SaltTestObject definition?
in C++:
class SaltMidiObject
:
public DynamicObject
{
public:
SaltMidiObject(JcfScriptRuntime & owner_)
:
owner(owner_)
{
setMethod("tag", tag);
}
class SaltTestObject : public DynamicObject
{
public:
SaltTestObject() {}
};
static var tag(const var::NativeFunctionArgs & args)
{
auto obj = getObjectWithArgumentCount<SaltMidiObject>(args);
return new SaltTestObject;
}
JcfScriptRuntime & owner;
};