![]() |
|
|
|
#1
|
|||
|
|||
|
Hello everyone.. As you can probably tell I am new at LUA programing. I followed all the directions in this tutorial at http://www.evilmana.com/tutorials/lua_tutorial_03.php and I am having problems. How do I make this error go away and make my "program" work?
I get an error message that says "Error: Variable Tut.LUA:18: attempt to perform arithmetic on global 'myBirthYear' (a nil value) Press start to restart" ("Variable Tut.LUA" is my file name.) - Here is my code: Code:
-- NOTES -- Green Color Object green = Color.new(0, 255, 0) -- Store birth year in variable myBirthYear myBirthyear = 1991 -- Store current year in currentYear currentYear = 2008 -- create an empty variable myAge = nil -- Store some text in a variable (Note the space after the last word before the end ") someText = "My age is roughly " -- Subtract myBirthYear from currentYear and store in myAge myAge = currentYear - myBirthYear -- Print our text variable to the screen (NOTE that there are no "" surrounding someText) screen:print(10,100,someText .. myAge,green) -- Buffer offscreen to onscreen (If this was a human, offscreen would be thinking about it, onscreen would be saying it) screen.flip() -- Loop forever while true do screen.waitVblankStart() end
__________________
------------------------------------------------------------------------------------ A true master of control is one who never seems to be in control ------------------------------------------------------------------------------------ |
![]() |
|
|
|||
|
|||
|
|
| Thread Tools | |
| Display Modes | |
|
|