Page 1 of 1

how to correctly invoke methods of a wrapper?

Posted: Mon Jul 06, 2020 3:05 am
by DracheTek
for example:

Code: Select all

>> target = ScenEdit_GetUnit({name='Taichung A/C Revetment (1x Large Aircraft)', guid='*SOME GUID THAT LOOKED LIKE PHONE NUMBER TO THE FORUM SYSTEM'})
 target.delete()
 ERROR: [string "Console"]:2:  instance method 'delete' requires a non null target object


so how to correctly invoke methods of a wrapper?

RE: how to correctly invoke methods of a wrapper?

Posted: Mon Jul 06, 2020 5:08 am
by michaelm75au
Taking the unit wrapper as example:
If you look up Command page http://commandlua.github.io/index.html#wrapper_Unit
it will show you the various properties of that wrapper.

There are also some examples of how they are accessed on the page.

RE: how to correctly invoke methods of a wrapper?

Posted: Mon Jul 06, 2020 9:14 am
by DracheTek
OK. 'Delete' is an "instance method", which needs a "self" parameter. using target:delete() will correctly invoke it.