lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


oh yes, I really think this has something to do with coroutines, because if
I change my entry point to a normal function, the problem disappears:


-- this crashes my app
local entryPoint_threaded = function ( _entity , _date , _delta )
   while true
   do
		-- do some stuff
		...
		-- yield true for normal termination (other yields will
signal AI suspension)
		-- received parameters come from the arguments passed to the
entry point (from C++)
		-- _entity should always remain the same, _date should
always increase, _delta may fluctuate
		_entity , _date , _delta = coroutine . yield ( true )
   end
end

function getEntryPoint ( )
   return coroutine . wrap ( entryPoint_threaded )
end

-- but this does not
local entryPoint = function ( _entity , _date , _delta )
	-- do some stuff
	...
end

function getEntryPoint ( )
	return entryPoint
end