Programm has problems executing functions in a list
So i created a list in which healthpoints are supposed to be stored, but the programm doesnt do these calculations upon start an just sets every value to zero. wierdly if i remove the code and paste it again, same code, same spot in my programm, it suddenly works, on top every 5 refreshes or so i get bombardet with Warning: realhp(player_team[0],player_level[0]) is not a function, in file "z_player_memory" at line 3, column 49.
this is my code:
realhp = function(p,lv)
local hp=basis_hp[p]
local realhp=scale(hp,lv)
return realhp
end
player_team=[1,2,1,1,1,1]#
player_level=[5,10,5,5,5,5]
player_hp=[realhp(player_team[0],player_level[0]),realhp(player_team[1],player_level[1]),
realhp(player_team[2],player_level[2]),realhp(player_team[3],player_level[3])
,realhp(player_team[4],player_level[4]),realhp(player_team[5],player_level[5])]
every list used here is defined and every function too, and as i said it works if i cut the code and paste it back so i guess it works in theory. I suspect it has something to do with the placement of the list, it currently sits in a source, and i thougth thats not a problem, because its judt a list but i guess this is not true if u use functions to get the values Idk.
Edit : I got it to work if i put the list in the init() function, so i found a temporary fix, but i dont want to crowd my init() function so hard, so if somebody knows a way to get this to work differently im very open for ideas/suggestions