Difference between revisions of "love.bundle"

m (Linkification)
m (Other Languages)
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
* [http://love2d.org/forums/viewtopic.php?f=5&t=1303 Original Thread]
 
* [http://love2d.org/forums/viewtopic.php?f=5&t=1303 Original Thread]
 
 
 
{{#set:LOVE Version=Any}}
 
{{#set:Description= Data saving lib for Love.}}
 
[[Category:Libraries]]
 
  
 
love.bundle is a [[library]] for storing game data between sessions. Unlike the most used saving systems, you don't have to make your own converting algorithm for data to text and the opposite. Here all you have to do is putting your data in a created bundle, and save it. The library also features a function for setting a function to be called when the game exits, here the user can put stuff like saving their bundles. The bundle can store 4 types of values:
 
love.bundle is a [[library]] for storing game data between sessions. Unlike the most used saving systems, you don't have to make your own converting algorithm for data to text and the opposite. Here all you have to do is putting your data in a created bundle, and save it. The library also features a function for setting a function to be called when the game exits, here the user can put stuff like saving their bundles. The bundle can store 4 types of values:
  
* [[String]]
+
* [[string]]
* [[Number]]
+
* [[number]]
* [[Boolean]]
+
* [[boolean]]
* [[Nil]]
+
* [[nil]]
  
 
Those 4 different types of values can easily be put into a created bundle or read from one with this:
 
Those 4 different types of values can easily be put into a created bundle or read from one with this:
Line 40: Line 34:
  
 
To understand this more, you can download the documentation I have created which is just like the [[LÖVE Documentation]] one. It looks the same to make it easier to understand since you don't have to get used to a new type.
 
To understand this more, you can download the documentation I have created which is just like the [[LÖVE Documentation]] one. It looks the same to make it easier to understand since you don't have to get used to a new type.
 +
 +
{{#set:LOVE Version=Any}}
 +
{{#set:Description= Data saving lib for Love.}}
 +
{{#set:Keyword=Serializing}}
 +
[[Category:Libraries]]
 +
== Other Languages ==
 +
{{i18n|love.bundle}}

Latest revision as of 16:03, 15 December 2019

love.bundle is a library for storing game data between sessions. Unlike the most used saving systems, you don't have to make your own converting algorithm for data to text and the opposite. Here all you have to do is putting your data in a created bundle, and save it. The library also features a function for setting a function to be called when the game exits, here the user can put stuff like saving their bundles. The bundle can store 4 types of values:

Those 4 different types of values can easily be put into a created bundle or read from one with this:

-- Create a bundle with the given name/identifier
Bundle = love.bundle.newBundle("A Bundle Name")

-- Change the identity of the bundle
Bundle:setIdentity("Another Bundle Name")

-- Save the bundle to the saving directory
Bundle:save()

-- Load a saved bundle with that name if it exists
Bundle = love.bundle.loadBundle("Another Bundle Name")

-- Set aFunction to be called when someone exits the game
love.bundle.setExitFunction(aFunction)

-- The return value tells you whether the operation succeeded or not
success = Bundle:put("Name Of The Value", 42)

-- Return the value with that name, or nil if not found
var = Bundle:get("Name Of The Value")

-- Return the value with that name, or the 2nd argument if not found
var = Bundle:get("Name Of A Not Created Value", true)

To understand this more, you can download the documentation I have created which is just like the LÖVE Documentation one. It looks the same to make it easier to understand since you don't have to get used to a new type.

Other Languages