Creating objects with new properties at runtime?

Does anyone know authoritatively whether you can create new properties at runtime?
Let’s say I’m writing a patch file for an existing .t3 game, and I want to add something that can’t be defined by the existing constructors of existing classes.
I tried inline objects like this:

//in patch file
function {
   local obj = object: TranscriptTransform {
      applyTransform(tr,vec) { ... }
      tagText = 'b'

But when I launch the interpreter it fails immediately saying “global symbols can’t be added in runtime compilation” (it’s referring to ‘tagText’).
I also tried

// in patch file
function {
   local tt = TranscriptTransform.createInstance();
   tt.setMethod(&propNotDefined, method(prop,[args]) {
      if(prop==&tagText) return 'b';
      else return inherited(prop,[args]); });
   tt.setMethod(&applyTransform, method {...});
   CommandTranscript.transforms_ += tt;

But if I try to use tagText in the anonymous method, I get an error for undefined symbol.
Any gurus with advice? Or is adding new properties at runtime simply not possible?

The t3AllocProp() (t3vm Function Set ( function creates a new property at runtime. But, as you noted, dynamic compilation can’t produce new global symbols. So you’d need your own global lookup table somewhere to stow away the new property for future use.

1 Like

I forgot about the t3 functions! I’ll have to play with this idea, thanks!