{"id":15723206,"url":"https://github.com/melsoft-games/defold-protobuf","last_synced_at":"2025-05-13T04:54:16.261Z","repository":{"id":114021877,"uuid":"179141634","full_name":"Melsoft-Games/defold-protobuf","owner":"Melsoft-Games","description":"Defold NE for work with protobuf","archived":false,"fork":false,"pushed_at":"2019-05-14T16:32:06.000Z","size":135,"stargazers_count":12,"open_issues_count":4,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-13T04:54:10.307Z","etag":null,"topics":["defold","defold-library","defold-module"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Melsoft-Games.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-02T19:06:02.000Z","updated_at":"2025-03-26T21:32:42.000Z","dependencies_parsed_at":"2023-05-22T06:30:26.259Z","dependency_job_id":null,"html_url":"https://github.com/Melsoft-Games/defold-protobuf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Melsoft-Games%2Fdefold-protobuf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Melsoft-Games%2Fdefold-protobuf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Melsoft-Games%2Fdefold-protobuf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Melsoft-Games%2Fdefold-protobuf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Melsoft-Games","download_url":"https://codeload.github.com/Melsoft-Games/defold-protobuf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253877498,"owners_count":21977642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["defold","defold-library","defold-module"],"created_at":"2024-10-03T22:10:40.854Z","updated_at":"2025-05-13T04:54:16.228Z","avatar_url":"https://github.com/Melsoft-Games.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](docs/logo.png)\n\n# Defold-Protobuf\n\nDefold-Protobuf [Native Extension](https://www.defold.com/manuals/extensions/) for the [Defold Game Engine](https://www.defold.com) \n\nThis extension allow you work with google protobuf protocol (files .proto), encode and decode them.\n\n\n## Platforms\n\n* **iOS**\n* **Android**\n* **MacOS**\n* **Windows**\n\n## Setup\n\nYou can use the Defold-Protobuf extension in your own project by adding this project as a [Defold library dependency](https://www.defold.com/manuals/libraries/). Open your game.project file and in the dependencies field under project add:\n\n\u003e https://github.com/Melsoft-Games/defold-protobuf/archive/master.zip\n\nOr point to the ZIP file of a [specific release](https://github.com/Melsoft-Games/defold-protobuf/releases).\n\n## Short API:\n\n``` lua \nlocal protoc = require(\"pb.protoc\")\n\nprotoc:loadfile(\"resources/test.proto\")\nlocal data = {\n\tvalues = {\n\t\tfirst = {\n\t\tnumber = 1.5,\n\t\tunumber = 20,\n\t\tstring = \"hello\"\n\t}\n}\n\n-- some.Example - name of message from test.proto\nlocal bytes = pb.encode(\"some.Example\", data)\nlocal unpackage = pb.decode(\"some.Example\", bytes)\n```\n\n## API\n\n### **protoc** - lua module to parse proto files\nThis part of docs from [lua-protobuf README](https://github.com/starwing/lua-protobuf/blob/master/README.md)\n\n| Function                | Returns       | Descriptions                                         |\n| ----------------------- | ------------- | ---------------------------------------------------- |\n| `protoc.reload()`       | true          | reload all google standard messages into `pb` module |\n| `protoc:parse(string)`       | table         | transform schema to `DescriptorProto` table          |\n| `protoc:parsefile(string)`   | table         | like `protoc:parse()`, but accept filename                |\n| `protoc:compile(string)`     | string        | transform schema to binary *.pb format data          |\n| `protoc:compilefile(string)` | string        | like `protoc:compile()`, but accept filename              |\n| `protoc:load(string)`        | true          | load schema into `pb` module                         |\n| `protoc:loadfile(string)`    | true          | like `pb:loadfile()`, but accept filename (you can point file from custom resouces in Defold)            |\n| `protoc.loaded`              | table         | contains all parsed `DescriptorProto` table          |\n| `protoc.paths`               | table         | a table contains import search directories           |\n| `protoc.unknown_module`      | see below     | handle schema import error                           |\n| `protoc.unknown_type`        | see below     | handle unknown type in schema                        |\n| `protoc.include_imports`     | bool          | auto load imported proto                             |\n\n\n### **pb** - native extension symbol\n#### `pb.encode(message_name, data)`\nreturns bytes of lua table *data*. Data should be match to proto description *message_name*\nIf proto file has `package {name};` *message_name* will be `{name}.{message_name}`\n\n#### `pb.decode(message_name, bytes)`\nreturns lua table from bytes. Bytes should be match to proto description *message_name*\n\n\nFull README to **pb** and **protoc** read [here](https://github.com/starwing/lua-protobuf/blob/master/README.md)\n\n\n## License, Authors\n*MIT license*\nThis NE wrapped by [AKashpur](https://github.com/AKashpur)\n\nOriginal module: [lua-protobuf](https://github.com/starwing/lua-protobuf)\n\n## Issues and suggestions\n\nIf you have any issues, questions or suggestions please [create an issue](https://github.com/Melsoft-Games/defold-protobuf/issues) or contact me: insality@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelsoft-games%2Fdefold-protobuf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelsoft-games%2Fdefold-protobuf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelsoft-games%2Fdefold-protobuf/lists"}