-
That was me. But the thing is it wasn't in the list of all the commands, so im not sure if it will work. The command was: io.input(”file.txt”) where file.txt is your file.
To write maybe io.output("...") works. You will have to try it out.
@ PSPHax0r9
Sure you can send it to me. Ill give it a look.
-
@Altair - yes start and select do, why?
-
can somebody give me a sample code for a timer?
-
One comes included with luaplayer.
@Altair - I PM'ed you.
-
EDIT: Sorted it out, just need to do click function!
-
hey i have a problem so here it is:
i am using a function to blit something to the screen when i press x but now it won't stay on the screen heres my function:
Code:
function duplicatetoplaser()
screen:blit(playerx+10,playery-31, playerlasertop)
screen.flip()
screen:waitVblankStart()
end
thanks in advance
-
thats because you only call the function when you press "X". So what happens is, you press X, then it goes through the function ones and then the next loop it makes its gone again.
BTW 100th post W000T!!! Im a Journeyman, im a Journeyman!
-
so what would i do then to make it stay there permently?
-
Hi everyone! I have an idea for a game but I'm just learning Lua so can someone give me a bit of code to get me started? I want a simple little game that there are 3 constantly bouncing balls that when you press a trigger, you can select one and move it right or left. I need some help. How do you make it so you can switch between them and how can you make them bounce constantly. Those are my main issues. Help would be appreciated. Thank you!
-
im trying to get highscore working in my game but it always gives me an error
Code:
attempt to compare nil with a number
these are my functions
save function
Code:
function saveHighscore()
file = io.open(highscoreFile, "w")
if file then
file:write(high)
file:close()
end
end
load function
Code:
function loadHighscore()
file = io.open(highscoreFile, "r")
if file then
high = file:read("*n")
file:close()
end
end
this is how i call the funtion in my game(the write variable is to make sure it only saves once)
Code:
if write==1 then
loadHighscore()
if high<score then
high=score
saveHighscore()
write=2
end
end
i know the save funtion works because if i get rid of the part where i compare the highscore variable to your score(and just save the score) it saves it.
i know the load funtion is fine because in my menu script i have an option to view highscore.
Code:
function loadHighscore()
file = io.open(highscoreFile, "r")
if file then
high = file:read("*n")
file:close()
end
end
then i just have it print the high variable and it works fine. but when i combined the two i get the error and i dont know why.