What is a nil value in LUA.
Sorry I am still learning LUA
Printable View
What is a nil value in LUA.
Sorry I am still learning LUA
Can someone also give me an example of how to load a ttf font and display it also.
im trying to make a maze in lua.. like a oldschool one.. like this
http://sinai.critter.net/gallery/blakat-maze.gif
i would like to have the joystick be a image.. and i would like to make it detect when i hit a black line on the maze.. whats the best way to go about that? thanks for your help!
I think its either one of two things.Code:function check(dummy)
if dummybb[1].x + 49 >= house1x and dummybb[1].x + 49 <= house1x + 21 and dummybb[1].y + 20 >= house1y and dummybb[1].y <= house1y + 20 and tile1show1a == 1 then
dummybb[1].go = false
tile1show1a = 2
end
if tile1show1a >= 2 then
screen:fillRect(house1x, house1y, 21, 21, blue)
screen:blit(house1x, house1y, house1R)
end
and/orCode:function check(dummy) -- nowhere in your function does it mention "dummy" again
Code:tile1show1a = 2
end
if tile1show1a >= 2 then -- turn ">=" into "=="
screen:fillRect(house1x, house1y, 21, 21, blue)
screen:blit(house1x, house1y, house1R)
Zitat:
Zitat von EminentJonFrost
Its def. not the second part.
I tried something and now i get
Code:error:attempt to index field '?' <a nil value>
anyone know what that means?
A nil value is a variable that you haven't declared yet. Example:Zitat:
Zitat von cwirsing
You haven't declared bob yet, if you put bob = 1 above while true do, you declared it and the program can perform functions on it.Code:red = Color.new(255,0,0)
while true do
screen:clear()
pad = Controls.read()
if pad:up() then
bob = bob + 1 --This would return an error saying that the program is trying --to execute an arthimetic function on a nil value.
end
screen.waitVblankStart()
screen.flip()
end
--PSPduh
Also, nil means that is has no value at all, nothing.
Who unstickied this?
As you might see, there is a thread called "Programming help" which is stickied, the "Lua help thread" is linked from there.Zitat:
Zitat von PopcOrn DeVil
http://forums.qj.net/psp-development-forum/53689-new-developers-read.html
yeah, this is all serideths doing ;)Zitat:
Zitat von PopcOrn DeVil