Giter VIP home page Giter VIP logo

defold-parser's Introduction

Github-sponsors Ko-Fi BuyMeACoffee

CI/CD npm

Defold Parser - node module to encode and decode Defold files.

Install

To install defold-parser use npm.

npm install --save defold-parser

For update defold-parser you can use

npm update --save defold-parser

Usage

Add require line to your .js script:

const defold_parser = require("defold-parser")

All available API is:

// Parse any Defold file (go, gui, collection, particlefx, etc)
let object = defold_parser.load_from_file([path_to_defold_file])

// Save object to the Defold format
defold_parser.save_to_file([path_to_file], [object])

// You can pass text string directly
let object = defold_parser.decode_object([defold_text_string])

// And get Defold encoded text directly too
let defold_text_string = defold_parser.encode_object([js_object])

Every Defold parsed struct is array, even for single fields. To access any field you should access it on first array index. For example:

let parsed_collection = defold_parser.load_from_file("./tests/files/collection.collection")
let instance = parsed_collection.embedded_instances[0]

assert(instance.id[0] == "tile")
assert(inner_component.id[0] = "sprite")
assert(inner_component.type[0] = "sprite")

To know, which fields you wanna edit, see the file struct you parsing or just use console.log in development 😄

License

Issues and suggestions

If you have any issues, questions or suggestions please create an issue or contact me: [email protected]

❤️ Support project ❤️

Please support me if you like this project! It will help me keep engaged to update this project.

Github-sponsors Ko-Fi BuyMeACoffee

defold-parser's People

Contributors

insality avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.