Object Sprite check

  • #1, by darren-beckettWednesday, 19. August 2015, 15:20 5 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

    351 Posts


  • #2, by ke4Wednesday, 19. August 2015, 18:13 5 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
    1
    2
    3
    4
    5
    6

    Key Killer

    810 Posts

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

    Great Poster

    351 Posts

Write post