Vungle ad plugin issues

I am working implementing Vungle in my app and when I call ads.init, I get the following error:


Corona Runtime Error

?:0: attempt to concatenate a table value
stack traceback:
?: in function ‘providerNameToModuleName’
?: in function ‘requireProvider’
?: in function ‘setCurrentProvider’
?: in function ‘init’
scripts\game.lua:7: in function ‘new’
main.lua:3: in main chunk

Here is the code calling ads.init:

 

local game = {}
local gameMetaTable = {__index = game}

function game.new ()
 local newGame = {}
 newGame.ads = require (“ads”)
 newGame.ads:init (“vungle”, “–[[my app ID here]]”, function () game:adcallback () end)

 return setmetatable (newGame, gameMetaTable)
end

function game:adcallback ()
 – do stuff with the ad in here
end

return game

In light of all this, my question is really this: How do I properly initialize Vungle ads with Corona SDK?

Bump

This looks wrong: 

 newGame.ads:init ("vungle", "--[[my app ID here]]", function () game:adcallback () end)

The appID should be what you declared in the Vungle control panel and the callback function needs just the name of the function not a function wrapped inside another one. Also “game:adcallback” should have a forward declaration if you are going to declare it after your ads:init line.

Having said that I don’t think the error refers to that line in particular.

I’m not sure the value of putting ads into an object like this, nor am I sure about using an anonymous function as the call back listener either. At a minimum I would do:

function ( event ) game:adcallback ( event ) end)

The ad call back function receives an event table and you need that inside the function.

Rob

Bump

This looks wrong: 

 newGame.ads:init ("vungle", "--[[my app ID here]]", function () game:adcallback () end)

The appID should be what you declared in the Vungle control panel and the callback function needs just the name of the function not a function wrapped inside another one. Also “game:adcallback” should have a forward declaration if you are going to declare it after your ads:init line.

Having said that I don’t think the error refers to that line in particular.

I’m not sure the value of putting ads into an object like this, nor am I sure about using an anonymous function as the call back listener either. At a minimum I would do:

function ( event ) game:adcallback ( event ) end)

The ad call back function receives an event table and you need that inside the function.

Rob