of     1   

unholysoda
#111216435Tuesday, August 27, 2013 3:22 AM GMT

In my game, the main game loop calls on some coroutines to run stuff. After the loop has successfully run once, I get his error. Any help? Workspace.Game:84: bad argument #1 to 'wrap' (Lua function expected) Line 84: Start_1 = coroutine.wrap(Game(1))
cntkillme
#111216529Tuesday, August 27, 2013 3:23 AM GMT

You can't make a function called game I don't think, but do: coroutine.wrap(Game, 1) or coroutine.wrap(function() Game(1) end)
unholysoda
#111216620Tuesday, August 27, 2013 3:24 AM GMT

I tried renaming it. Still got the same error. http://www.roblox.com/My/Groups.aspx?gid=66545
unholysoda
#111270225Tuesday, August 27, 2013 8:05 PM GMT

unholysoda
#111274895Tuesday, August 27, 2013 8:53 PM GMT

SolarCrane
Forum Moderator
#111275217Tuesday, August 27, 2013 8:56 PM GMT

coroutine.wrap returns a function that will start a coroutine. The function that coroutine.wrap returns will take the arguments that you want to pass into the wrapped function. You can use it like this: function myFunction(myArg) print(myArg) end coroutine.wrap(myFunction)("Hello")
KnightmareXD
#111275386Tuesday, August 27, 2013 8:58 PM GMT

Can you post the function?
KnightmareXD
#111275592Tuesday, August 27, 2013 8:59 PM GMT

Oh, you would do this: Line 84: Start_1 = coroutine.wrap(Game) Start_1(1)
unholysoda
#111277499Tuesday, August 27, 2013 9:17 PM GMT

The full code. It works once, but the next time the loop executes, I get that error. function Part() print("Test") end while wait(15) do Start_Area = coroutine.wrap(Part(1)) Start_Area() end http://www.roblox.com/My/Groups.aspx?gid=66545
unholysoda
#111278162Tuesday, August 27, 2013 9:23 PM GMT

Never mind. I got it working. Thank you very much. http://www.roblox.com/My/Groups.aspx?gid=66545

    of     1