oniksan / godobuf

A Google Protobuf implementation for Godot / GDScript
BSD 3-Clause "New" or "Revised" License
261 stars 36 forks source link

feature: Add setter for message fields #40

Open ADustyOldMuffin opened 10 months ago

ADustyOldMuffin commented 10 months ago

I'm curious if we could add setters for fields such as arrays and messages, is there any reason you couldn't? Its quite a pain if you already have an object created to then have to create another and set all the fields.

rcorre commented 9 months ago

For arrays, you can do this:

msg.get_list().assign(my_list)

I agree a way to assign a message would be useful though. I'm not sure if set_message(msg) should copy msg, or assign a reference.

Maybe implementing CopyFrom on message types would make it more clear.