and3rson / foreigner

FFI library for Godot, built with GDNative
MIT License
25 stars 4 forks source link

Support additional Godot argument types #2

Open follower opened 4 years ago

follower commented 4 years ago

Creating this issue as a way to keep track of adding support for more Godot argument types:

follower commented 4 years ago

Re: PoolByteArray (and Pool*Array in general) the related implementation in godot-python might be informative: https://github.com/touilleMan/godot-python/commit/e9347d6a319fb62a6cbeac79d20fba0f5b104145 (via)

Seems like the write access (at least) requires holding/destroying a lock.

(I also noted that the docs mentioned:

"Note: This type is passed by value and not by reference."

But I wasn't sure if this was only relevant at GDScript level or not.)

Edit: Add "via" link.

follower commented 4 years ago

Re: PoolByteArray, in Godot 4.0 these become PackedByteArray etc and become references (& thus mutable) :

Packed arrays are now references in GDScript

Users often complained that PoolArrays were immutable types, so accessing them inside sub-arrays, dictionaries, etc. or passing them to/from functions would always create copies.

In the 4.x branch, besides no longer being pool based, they became references. via