Git Product home page Git Product logo

Comments (2)

tung avatar tung commented on August 22, 2024

Saving Lua tables to files is complicated by the fact that their metatable relationships need to be restored on load somehow. I can't use persistence libraries that save metatables with regular ones, since that could lead to subtle bugs involving old and new metatable code when loading games.

I need to test existing persistence libraries to find if they're suitable, or can be adapted to this end.

from quipkit.

tung avatar tung commented on August 22, 2024

Let tables be saved/loaded with metatables kept.

  • Closed by 2ba932c.
  • Try ./game test/persistsave.lua, then ./game test/persistload.lua.
    Observe the messages and numbers displayed at the command line.
  • With persist.lua, tables, strings, numbers and the names of
    metatables are saved. When loading a table, the metatables of
    the saved tables are restored to metatables with the same name.
    This only works if the metatables are public, i.e. not local.
  • When saving, env can hold things like loaded Lua packages.
    When loading, a hook function can be passed and is called before
    loading the table data, so e.g. required Lua packages can be
    reloaded.

from quipkit.

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.