local helper = asset.require('util/slide_deck_helper')
local deck = nil

asset.onInitialize(function ()
  deck = helper.createDeck("example", {
    UseRadiusAzimuthElevation = true,
    RadiusAzimuthElevation = {1.0, 0.0, 0.0}, -- use for dome
    UsePerspectiveProjection = true,
    FaceCamera = true,
    Scale = 0.7
  })

  helper.addSlide(deck, "${DATA}/test2.jpg")
  helper.addSlide(deck, "${DATA}/test3.jpg")

  local interpolationDuration = 0.5

  function nextSlide()
    helper.goToNextSlide(deck, interpolationDuration)
  end

  function previousSlide()
    helper.goToPreviousSlide(deck, interpolationDuration)
  end

  function toggleSlides()
    helper.toggleSlides(deck, interpolationDuration)
  end

  helper.setCurrentSlide(deck, 1)
  openspace.bindKey("KP_6", "nextSlide()", "Next slide", "Next slide", "/Slides")
  openspace.bindKey("KP_4", "previousSlide()", "Previous slide", "Previous slide", "/Slides")
  openspace.bindKey("KP_0", "toggleSlides()", "Toggle slides", "Toggle slides", "/Slides")
end)


asset.onDeinitialize(function()
  openspace.clearKey("KP_6")
  openspace.clearKey("KP_4")
  openspace.clearKey("KP_0")
  helper.removeDeck(deck)
end)

local helper = asset.require('util/slide_deck_helper')
local deck = nil

asset.onInitialize(function ()
  deck = helper.createDeck("example", {
    UseRadiusAzimuthElevation = true,
    RadiusAzimuthElevation = {1.0, 0.0, 0.0}, -- use for dome
    UsePerspectiveProjection = true,
    FaceCamera = true,
    Scale = 0.7
  })

  helper.addSlide(deck, "${DATA}/test2.jpg")
  helper.addSlide(deck, "${DATA}/test3.jpg")

  local interpolationDuration = 0.5

  -- Add global functions for controlling slide deck and bind to keys
  rawset(_G, "nextSlide", function()
    helper.goToNextSlide(deck, interpolationDuration) 
  end)

  rawset(_G, "previousSlide", function()
    helper.goToPreviousSlide(deck, interpolationDuration)
  end)

  rawset(_G, "toggleSlides", function()
    helper.toggleSlides(deck, interpolationDuration)
  end)

  helper.setCurrentSlide(deck, 1)
  openspace.bindKey("KP_6", "nextSlide()", "Next slide", "Next slide", "/Slides")
  openspace.bindKey("KP_4", "previousSlide()", "Previous slide", "Previous slide", "/Slides")
  openspace.bindKey("KP_0", "toggleSlides()", "Toggle slides", "Toggle slides", "/Slides")
end)


asset.onDeinitialize(function()
  openspace.clearKey("KP_6")
  openspace.clearKey("KP_4")
  openspace.clearKey("KP_0")
  helper.removeDeck(deck)
end)

Fix to make slide deck work with new strict Lua
Fix to make slide deck work with new strict Lua
