I am trying to use corutines to update my many npc in the game about ten times every frame but I can seem to be able to send arguments with corutine.wrap
here is some example code of what does looks like:
local Class = {}
Class.__index = Class
function Class.new()
local newObject = {}
setmetatable(newObject, Class)
return newObject
end
function Class:Print(x)
print(x)
end
local object = Class.new()
coroutine.wrap(object.Print)(69)
--Prints 'nil'
what i have tried so far:
coroutine.wrap(object.Print())(69) --nil
coroutine.wrap(object:Print(69)) --works but throws an error
--missing argument #1 to 'wrap' (function expected)
coroutine.wrap(object:Print())(69) --nil
coroutine.resume(coroutine.create(object.Print), 69) --nil