Giter Club home page Giter Club logo

Comments (7)

CraftSpider avatar CraftSpider commented on August 26, 2024

Thank you for the heads-up, I'll try to take a look and get a fix pushed in the next day or so.

from rbxm-rs.

GlowingUmbreon avatar GlowingUmbreon commented on August 26, 2024

It appears this new property is the Font type https://github.com/RobloxAPI/spec/blob/master/formats/rbxl.md#font

from rbxm-rs.

CraftSpider avatar CraftSpider commented on August 26, 2024

I've added the new type as FontFace, I'm currently working on making sure everything else is also up-to-date, once that's true I'll release a new version.

from rbxm-rs.

GlowingUmbreon avatar GlowingUmbreon commented on August 26, 2024

I'm currently working on making sure everything else is also up-to-date, once that's true I'll release a new version.

Ah, do you not have a automatic system for doing so? I assumed that you had some script that would update enums.rs and instance.rs automatically.

from rbxm-rs.

CraftSpider avatar CraftSpider commented on August 26, 2024

No, I intend to add one at some point, but don't currently have something that does it. At that point I would likely do something more like the windows crate does, and generate the actual definitions off of the API dumps. I do have a script that generates basically an instance of every type, and then I just run that through the tests and fix all the issues it surfaces.

from rbxm-rs.

GlowingUmbreon avatar GlowingUmbreon commented on August 26, 2024

Ah okay, also quick question how do you get the attributes for a instance? I have read the docs and looked at the source code but I still cannot figure it out. I assume I need to TryInto a actual instance something but I am sure how to do so.

    let settings = match map.get_path("0/Settings/Main") {
        Ok(settings) => settings,
        Err(ModelError::NotFound) => panic!("Couldn't find instance named \"Settings\""),
        Err(ModelError::AmbiguousPath) => panic!("Found more than one instance named \"Settings\""),
        Err(err) => panic!("Model Error: {}", err),
    };

    println!("{:?}", settings.attributes);

from rbxm-rs.

CraftSpider avatar CraftSpider commented on August 26, 2024

get_path returns an Instance. To get the attributes, you would match on it - depending on what type you expect it to be, something like

match settings {
    Instance::Script(script) => { /* here, you access a script's attributes by name, such as `script.source` */ }
    _ => { /* What to do if the instance isn't what you expected */ }
}

I'm considering possible ways to simplify this a bit, for example providing a method on Instance to attempt to read it as an item or any subclass of that item. If you have any more questions, or ideas on how you'd prefer the API to look, feel free to open other issues. Also if there's any documentation you think should be added.

from rbxm-rs.

Related Issues (3)

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.