Code Monkey home page Code Monkey logo

Comments (5)

 avatar commented on June 30, 2024 1

You would want to store such information in the Lua state registry. See getMTCache in cache.go for an example of how we currently use the registry.

from gopher-luar.

bbuck avatar bbuck commented on June 30, 2024

@bontibon I see you already assigned this to you, but I went ahead and put what I was thinking into code and made a PR. Would love a code review when you have time. Thanks!

from gopher-luar.

 avatar commented on June 30, 2024

Thanks for your thoughts, @bbuck.

I agree that the enforced dual naming for (at least) methods is not great. Struct fields I'm not as concerned about, as they can be explicitly set with the "luar" tag.

Your proposed solution and PR with the luar.Configure function cannot be added, as it modifies global state. The solution needs to operate on types in a specific *lua.LState.

A possibility I see is adding a helper to luar.MT that removes (or prevents) a specific set of methods.

from gopher-luar.

bbuck avatar bbuck commented on June 30, 2024

Where would a good place be to store this information on an LState? I've toyed with a similar feature in my current project for passing around values tied directly to an LState but I'm not sure how best to store meta information. I started using globals like _SOME_GLOBAL_NAME on the state but then, for my use case, chose to wrap stats with a data container so that values can't be modified from within scripts run.

Long story short, I'm not super familiar with the internals of Lua (yet) but I'm trying to learn. Where do you think might be the best place to store information like this? I'm totally willing to make the change in my PR.

from gopher-luar.

bbuck avatar bbuck commented on June 30, 2024

Thanks for doing this, much more compact than the new concept that I had.

from gopher-luar.

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.