oniksan / godobuf

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

feature: Add setter for message fields #40

Open ADustyOldMuffin opened 8 months ago

ADustyOldMuffin commented 8 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 7 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.