Comments (2)
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.
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)
- Free OpenGL textures used by sprites HOT 2
- New sprite library can't find instance methods HOT 1
- Remove event hooks from game.lua HOT 1
- Add reference documentation for libs HOT 1
- Support more image formats HOT 1
- Improve SFont support with game.lua HOT 1
- sfont.glFont draws text at wrong x position HOT 1
- Let gamelets call hooks in gamelets below it HOT 1
- Game screen doesn't redraw when switching windows HOT 1
- Refactor SDL surface to OpenGL texture conversion HOT 1
- Refactor gamelets to use Lua packages HOT 1
- Add TrueType font support HOT 1
- Add high-level audio API HOT 1
- Sprites turn white after a while HOT 1
- Add asset support
- Build sdlgl for Windows HOT 1
- Compile luagl.dll and luaglu.dll for Windows HOT 1
- lib/sdlgl/sdlgl.c:236 creates table for 1 entry, but has 2
- Rename ltcl.so to libltcl.so and ltk.so to libltk.so
- luasocket doesn't compile on Ubuntu HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quipkit.