Multiple contexts

Open
#49 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
lua

Research direction

Start by tracing the pb and protoc module entry points and how they currently store state within a Lua state. Define and implement the context-passing API shown in the issue so two contexts can load conflicting definitions independently, then verify that each context resolves its own Hello type.

Written by the indexing model from the issue text.

Description

enhancement

Could you add the ability for multiple pb contexts within a single lua state?
Ideally the API would be to make everything a method that passes the context around.
e.g.

local pb_ctx = require "pb".new()
local pb_compiler = require "protoc".new(pb_ctx)
assert(pb_compiler:load(someproto))
local mytype = pb_ctx:type("Hello")


local pb_ctx2 = require "pb".new()
local pb_compiler2 = require "protoc".new(pb_ctx2)
assert(pb_compiler2:load(someproto)) -- where someproto contains a different/conflicting defintition of the same types.
local mytype2 = pb_ctx:type("Hello")
Dominant language
Lua
Stars
1.9k
Forks
400
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from starwing/lua-protobuf

All issues in starwing/lua-protobuf

Similar issues

More Lua issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.