Error in code

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

Moderators: Shine, Insert_witty_name

Post Reply
worldspawn
Posts: 4
Joined: Sun Jul 17, 2005 4:21 am

Error in code

Post by worldspawn »

I'm getting this error with the code below:
error: script.lua4: attempt to call global 'pidle' (a nil value)

I've been coding for about 4 months in Visual Basic.. Lua seems like an easy language, but I'm still learning. Bear with me. =]

Code: Select all

-- Animation Test

-- variables
pidle {}

-- graphics
pidle[1] = Image.load("gfx/pidle1.png")
pidle[2] = Image.load("gfx/pidle2.png")
pidle[3] = Image.load("gfx/pidle3.png")
pidle[4] = Image.load("gfx/pidle4.png")
pidle[5] = Image.load("gfx/pidle5.png")

-- animation
while true do
  
   for x=1,5 do
      screen:blit(200, 100, pidle[x])
      screen:flip()
      screen.waitVblankStart(3)
   end

end
KawaGeo
Posts: 191
Joined: Sat Aug 27, 2005 6:52 am
Location: Calif Mountains

Post by KawaGeo »

The fourth line should be:

Code: Select all

pidle = {}
This way is to let Lua recognize pidle as a table.
Geo Massar
Retired Engineer
worldspawn
Posts: 4
Joined: Sun Jul 17, 2005 4:21 am

Post by worldspawn »

Thanks a bunch!

Ah man.. I should have seen that. Heh.
Post Reply