Giter Club home page Giter Club logo

Comments (6)

AThousandShips avatar AThousandShips commented on July 3, 2024

Feature proposals are tracked here, this is for bugs. Please open a proposal instead.

from godot.

Vlad-Zumer avatar Vlad-Zumer commented on July 3, 2024

Is this not a bug, or are Packed Arrays not supposed to be a better version of the normal Array?

from godot.

AThousandShips avatar AThousandShips commented on July 3, 2024

They're designed to be tighter and more performant storage, not a plain superior version, implementing these features would require writing new dedicated methods for them, as they do not exist in the underlying type, unlike Array, see here

So this isn't a missing intended feature, but something that can be discussed as an improvement

from godot.

AThousandShips avatar AThousandShips commented on July 3, 2024

The Packed*Array types are primarily designed to do two things:

  • Store data efficiently, by not storing Variant but the real data type
  • Pass data back and forth between scripting and the engine, especially for servers, in a way that avoids having to constantly convert between Array and what ever specific data type is required

Internally they just use an engine data type called Vector, which lacks a lot of the features Array does, the special methods in PackedByteArray for example is only available to scripting on PackedByteArray and are implemented in the bindings, not on the Vector<uint8_t> type itself. The same would likely have to be done for the suggested methods, as they would not be very relevant to Vector itself as we don't use those methods in the engine core

The one exception really would be sort_custom which already exists, but it'd have to be bound in a custom way as the built-in one doesn't take a Callable but a comparator

Further the pop methods have been suggested before but can't be trivially implemented, as they'd be unable to return a value, unlike Array where they can return Variant() there's no way really to return clearly a null for int for example. There'd be questions if pop_back/front/at should crash or not when the container is empty etc (like general access does with Vector). See:

from godot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.