Object Sprite check

  • #1, by darren-beckettWednesday, 19. August 2015, 15:20 10 years ago
    Can anyone tell me how i can use Lua to check an object has a sprite, so i can prevent throwing an error.

    if (obj.ObjectSprite) == null then
    -- return false
    else
    -- return true
    end

    Great Poster

    384 Posts


  • #2, by ke4Wednesday, 19. August 2015, 18:13 10 years ago
    Hi not sure if it's the shortest way though.

    if getObject("Scenes[name].SceneObjects[name]"):getLink(VObjectSprite):isEmpty() then
    -- it's empty (true)
    else
    -- object has sprite (false)
    end
    

    Key Killer

    810 Posts

  • #3, by darren-beckettWednesday, 19. August 2015, 23:36 10 years ago
    Thanks

    Great Poster

    384 Posts