Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
attempt to index global ... — Gideros Forum

attempt to index global ...

loves_oiloves_oi Member
edited July 2012 in General questions
When i find a sample lua code on the web , i'm trying on gideros. but i always take error. And i always take this error:

main.lua:29: attempt to index global 'display' (a nil value)
stack traceback:
main.lua:29: in function 'init'
main.lua:166: in main chunk

Why does this error ocur? Thnks in advance

Dislikes: marbolec

Tagged:
+1 -1 (+0 / -1 )Share on Facebook

Comments

  • In your code, you must have something like:
    display:something()
    However, display is not in the API for Gideros, so it is undefined, which is why you are getting a nil value for it. You may want to read through some of the Gideros Academy here to find some links for getting started with lua and maybe check out some tutorials.
  • as @zvardin said you are trying to call an undefined function--I am guessing you are trying to use a tutorial or sample lua code from a Corona example. While they are lua, they use their own API in those samples such as the 'display' object, which don't exist in Gideros and will throw that error.

    I would suggest you go through and open and run each of the examples that come with Gideros Studio and take a look at how the code works, those samples can really help you get a good hold of how Gideros Studio and the API work. :)
    ThumbHurt Games / FB: ThumbHurt Games / FB: Eli/Teranth | Skype: teranth37
  • i'm absolutely new to lua programming language. What should i do now ? both studying lua lang. and looking gideros examples? Or first looking gideros examples ? OR else? I know C,C++,JAVA . If you show me direct link , i will be very happy.thnks in advance
  • ar2rsawseenar2rsawseen Maintainer
    edited July 2012
    If you already know any of programming languages, then you know the basics.
    The concept here is a bit different lua being weakly typed dynamic language, but it still will be easier for you to grasp, than if you'd start from 0.

    I'd suggest you to start with examples. Set a goal what you want to accomplish and trying combining examples to do that.

    If you are interested in Box2d physics, you can try out tutorials from this thread:

    http://www.giderosmobile.com/forum/discussion/1387/box2d-tutorial#Item_2

    or here is a list of different examples and tutorials for gideros:
    http://giderostutorials.com/
  • atilimatilim Maintainer
    Also Programming in Lua is a great book and you can read the 1st edition online here: http://www.lua.org/pil/
Sign In or Register to comment.