kRPC: Control the game using C#, C++, Java, Lua, Python...

kRPC: Control the game using C#, C++, Java, Lua, Python...

7.8k Downloads

Add attribute to mark parameters as nullable

djungelorm opened this issue ยท 2 comments

commented

Currently, only the return value of a procedure call can be marked nullable (if it is a class type).

We should also be able to mark parameters as nullable. This is particularly useful in the python client, where we would like to be able to mark the type of a parameter as either MyClass or Optional[MyClass] depending on whether it is nullable.

By convention, any parameter not marked as nullable should never be null.

commented

Attribute has been added, and is used in TestServer and by python stub generator (for type hints).

Existing services (SpaceCenter, UI, Drawing, ...) need to be updated to use it.

commented

Also need to update this page to describe this attribute: https://krpc.github.io/krpc/extending.html#attributes