Mr Baker
Mr Baker

Reputation: 25

When creating a timer.SImple it gives me bad argument #2 error

When I try to create a timer.Simple in my code I am given this error:

bad argument #2 to 'Simple' (function expected, got no value)

I have looked for many different places to fine the answer but couldnt find anything to fix this. the code:

http.Fetch( "http://api.time-gaming.co.uk/lua-api.php?key="..ipsd.key.."&email="..ipsd.email.."&type=info",
function( body, len, headers, code )
    ipsd.initaldata = body
    print("Checking Licence Key!")
    print(ipsd.initaldata)
    timer.Simple( 2, activate() )
 end,
 function( error )
    print("Failed to recive data from the web!")
 end
)

Upvotes: 1

Views: 490

Answers (1)

Paul Kulchenko
Paul Kulchenko

Reputation: 26794

To expand on EgorSkriptunoff's suggestion in the comments: you are passing the result of the activate call to timer.Simple (which probably doesn't return anything), but you want instead to pass the actual function as this is what will be called by the timer when it expires.

Using timer.Simple(2, activate) should produce the result you want.

Upvotes: 1

Related Questions