Highscöre
Highscöre is a library which creates simple highscore tables.
Download it here.
See also SICK.
Updates
v1.1 - 8/2/10 - Cleaned up some code a bit (replaced some while loops with for statements). Compatible with v1.0.
How to use
First use love.filesystem.setIdentity or set the identity
field in conf.lua. Also be sure to use the following line of code before using the functions:
require "path/to/highscore.lua"
Alternatively, you can set the identity in the conf.lua file.
Then you can start using the functions seen below.
Functions
highscore_new(filename, places, name, score)
filename
- Name of text file where highscore table is stored.
places
- Number of places in highscore table.
name
- Name for "Nobody."
score
- Score for "Nobody."
Creates an empty highscore table. Use this if the highscore table doesn't exist yet.
highscore_load(filename)
filename
- Name of text file to load highscore table from.
Loads a highscore table. Be sure to use this before using highscore_add or highscore_write!
highscore_write(filename)
filename
- Name of text file to write highscore table to.
Writes the currently stored high scores. You'll probably want to use this after using highscore_add.
highscore_add(score, name)
score
- Score to enter into highscore table.
name
- Name that goes with score.
Enter a score into the highscore tale.