3

How can I remove a property from a variant object in Smart Pascal?

In JavaScript I can remove a property with the delete keyword delete obj['myProp'].

How to do it in Smart Pascal?

markus_ja
  • 2,931
  • 2
  • 28
  • 36

1 Answers1

4

Smart allows you to directly execute JavaScript code by reusing Delphi's asm syntax.

asm
  delete @obj['myProp'];
end;

The @obj syntax is necessary if you are referring to a Smart Pascal entity because the actual name may be something else than obj due to obfuscation. During compilation, @obj is replaced with the actual name of the entity.

gabr
  • 26,580
  • 9
  • 75
  • 141