Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
newbie - display library for lua - getting error — Gideros Forum

newbie - display library for lua - getting error

Unknown Member
edited February 2012 in General questions
Newbie question - I loaded up an example that starts with:

Img_knob - display.newImage("knob.png")

and I get the error about 'attempt to index global 'display' (a nil value). I understand that this is because my version of Lua doesn't have the 'display' library? (it works fine in Corona).

If that's the right guess, where do I find, and how to I load up the library.

Thanks!

Likes: DarkPixel

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

Comments

  • Hi Lauren,
    display is a library that is available in C*SDK, for a quick look at how to start with Gideros, there was a tutorial I had written a while ago.

    You can read it here http://howto.oz-apps.com/2011/11/options-to-create-mobile-apps.html

    I am also working on a compatibility library (between my projects) that will allow you to just compile your C*SDK code with Gideros without any changes, but that will take a bit and not available now.
    twitter: @ozapps | http://www.oz-apps.com | http://howto.oz-apps.com | http://reviewme.oz-apps.com
    Author of Learn Lua for iOS Game Development from Apress ( http://www.apress.com/9781430246626 )
    Cool Vizify Profile at https://www.vizify.com/oz-apps
  • Look unter bitmaps in the documentation and also in the samples. There is plenty of code to study and start with. The APIs of C*r*na are a little different, but Gideros is easy to understand and should get you running in no time.

    Anyway, here is a tiny example on how to load an image and display it in the center of your canvas:
    -- Create a new bitmap
    local img = Bitmap.new(Texture.new("yourImage.png"))
    -- Set the handle of it to its center
    img:setAnchorPoint(0.5, 0.5)
    -- Add the image as a child to the stage 
    stage:addChild(img)
    -- Set the position of the image to the center of the application canvas
    img:setPosition(application:getContentWidth()/2, application:getContentHeight()/2)
Sign In or Register to comment.