I have another question for now, related to synchronization.
Is the only thing that instantiates new threads the "love.thread.newThread " command?
I'm asking this because of the following problem:
I think there are cases in which a certain function A is called before another function B is finished (The call isn't made from within B, but by another thing), and that it messes up some variables.
Should I worry about synchronization if I'm not using love.threads?
EDIT: To be more specific- let's say I have these 2 functions.
Code: Select all
function gamefuncs.location_update (x, y, player)
--require("mobdebug").on()
map_vacant[player.grid_y_sqr][player.grid_x_sqr] = 0
player.grid_x = x - (x % 32)
player.grid_x_sqr = player.grid_x/32
player.grid_y = y - (y % 32)
player.grid_y_sqr = player.grid_y/32
player.tile_x, player.tile_y = 1+(math.floor (player.grid_x_sqr/4)),1+(math.floor (player.grid_y_sqr/4))
map_vacant[player.grid_y_sqr][player.grid_x_sqr] = 'ent'
end
Code: Select all
function gamefuncs.Check_EnemyDeath()
---[[
for i, ent in pairs(Enemies) do
if Enemies[i].HP <= 0 then
map_vacant[Enemies[i].grid_y_sqr][Enemies[i].grid_x_sqr] = 0
Enemies[i] = nil
end
end
--]]
gamefuncs.generateVisible()
end
Is it possible for the first one to be called, and then have the second called as well before the first finishes?