Record

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
Gefa
Posts: 11
Joined: Wed Aug 13, 2008 8:31 pm
Location: Italy
Contact:

Record

Post by Gefa »

Hi!
I have this code:

Code: Select all

file = io.open("highscore.txt","r")
record_score = file:read()
file:close()
But, when I try to print record_score string with

Code: Select all

screen:print(0,0,""..record_score,color)
LuaPlayer return an error, "record_score is a nil value"
Whi?
For my PSP project, visit my web site: www.gefa.altervista.org

PaintMIXER v2.6.0 released: http://www.neoflash.com/forum/index.php ... 253.0.html
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

See the file io tutorial here: http://www.evilmana.com/tutorials/lua_tutorial_09.php

It looks like maybe the open() function failed, thus the read() failed also.

Error check that they return successfully.

Also, to read a number you need to pass *n to the read() call.
Post Reply