> For the complete documentation index, see [llms.txt](https://legacydmc.gitbook.io/dynamic/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://legacydmc.gitbook.io/dynamic/camera-exports/swapcamera.md).

# swapCamera

swapCamera( camIdx \[int] )

Swaps the current camera to the specified camera.<br>

```lua
        WarMenu.Button("Current Camera Index: ", '← '..tostring(cameraIndex)..' →')
        if WarMenu.IsItemHovered() then
            WarMenu.ToolTip('User the arrow keys to swap through available cameras.',nil,true)
            if IsControlJustReleased(2, 189) then
                cameraIndex = cameraIndex - 1
                if cameraIndex < 1 then
                    cameraIndex = cameraAmmount
                end
                dynamic:swapCamera(cameraIndex)
            end
            if IsControlJustReleased(2, 190) then
                cameraIndex = cameraIndex + 1
                if cameraIndex > cameraAmmount then
                    cameraIndex = 1 
                end
                dynamic:swapCamera(cameraIndex)
            end
        end   
```
