Update Main.lua

Update to use API