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

Calling constructors #9

Open
djungelorm opened this issue Mar 13, 2014 · 0 comments
Open

Calling constructors #9

djungelorm opened this issue Mar 13, 2014 · 0 comments
Labels
enhancement New feature or request protocol

Comments

@djungelorm
Copy link
Member

djungelorm commented Mar 13, 2014

Add support for calling constructors. For example:

conn = krpc.connect()
vessel = conn.space_center.Vessel("foo")
[KRPCClass(Service="SpaceCenter")]
class Vessel {
  [KRPCConstructor]
  Vessel (string name) { ... }
}

This should be relatively straightforward. The service definitions just contain an extra procedure call, that looks like a static class method, whose arguments are the same as the constructor, and return type is the class.

Generated client stubs would contain a call to this procedure in the constructor, and store the returned object id in the class instance.

Most of the work is in updating the clients.

@djungelorm djungelorm mentioned this issue Mar 26, 2023
10 tasks
@djungelorm djungelorm transferred this issue from krpc/krpc Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request protocol
Projects
None yet
Development

No branches or pull requests

1 participant