attempt to index global 'display' <a fimction value> (display.newLine)

newbie question - why would a simple:

local a=display.newLine(0,240,160,240)

throw up the following error:

attempt to index global 'display'

? If I move the command BEFORE my functions it works. If I place it after my functions, it doesn't ?

Post plug and play, please? :)

peach, this is weird. I'm a newbie with Lua and am wondering where I place the functions in my code and where I place the rest.

For example if I place the

local star = display.newLine(0,220,100,220) BEFORE my functions it works

if I place the line above AFTER my functions it doesn't work. I'm not calling any of my functions, and I've commented the rest of my code out out.

Do I take it, functions should be placed at the end of my main.lua ?

Hey again,

No, functions don't have to be placed at the end of your main.lua file.

How many lines of code have you got in your file?

If it isn't ridiculously long I can take a look and try to see what is up for you - there shouldn't be any issue regardless of where you place that line of code unless something else is interfering somehow.

Peach :)

views:1810 update:2011/12/30 9:10:41
corona forums © 2003-2011