Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_Scripting: added an example of OOP programming #14350

Merged
merged 1 commit into from
Dec 1, 2021

Conversation

tridge
Copy link
Contributor

@tridge tridge commented May 12, 2020

very useful pattern for more complex scripts

@tridge
Copy link
Contributor Author

tridge commented Jun 2, 2020

@WickedShell wants to redo this with metatables

@davidbuzz
Copy link
Collaborator

I think this should go in till @WickedShell has a chance to do something better. lgtm.

@WickedShell
Copy link
Contributor

Real metatables work nicely, #15653 add's support, and this should be easy to rework on top of that, but I don't have the time before the call to get that done.

@davidbuzz
Copy link
Collaborator

As best as i can tell this PR includes a script that does not use 'metatables' but should still work as-is..? Its beyond my knowledge to even know what a metatable is ... or how using them might change this PR, so i'm just trying to move this pr forward..... do we merge it, or close it.? :-)

very useful pattern for more complex scripts
@tridge
Copy link
Contributor Author

tridge commented Dec 1, 2021

@WickedShell i've changed the example to include both closure and metatable style of objects
I've tested memory overheads and with closures doing 2 objects costs approx 450 more bytes than using metatables. So for small numbers of objects it really doesn't matter

@tridge tridge merged commit 06ef5ae into ArduPilot:master Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants