Sorry this was first pass before properly debugging it, the main issue I’m having is using the nested lists. I’m currently using {{},{}}, I’m trying to use some sort of 2d array to properly display the characteristics while still remaining readable to me, however I’m now having an issue when I try to use if currenthearts[tonumber(counter)[0]]=="spicy"
due to an error of “attempting to index a number value”, the updated code is shown below
local counter=0
anim_full=hash("full")
anim_empty=hash("empty")
local heartcounter=56
local hearttable={0}
local deadheart="bruh"
local newtable = {}
--function used to draw the hearts on screen
local function clonehearts(self,garnish,bread)
self.clone= gui.new_box_node(vmath.vector3(0,0,0),vmath.vector3(70,65,0))
gui.set_texture(self.clone, "heart")
self.location=gui.set_screen_position(self.clone,vmath.vector3(heartcounter,690,0))
if garnish == "spicy" then
gui.play_flipbook(self.clone, "Spicy")
else
gui.play_flipbook(self.clone, "full")
end
self.heart = {garnish, "nul", self.priority}
end
--determins the priority of
local function redraw(self)
self.priority =0
while counter < #currenthearts do
if currenthearts[tonumber(counter)[0]]=="spicy" then
self.priority = self.priority + 1
end
table.insert(newtable,tonumber(self.priority),currenthearts)
counter=counter+1
end
counter = 0
while counter< #newtable do
clonehearts(self, newtable[2],newtable[3])
counter=counter+1
end
end
function init(self)
msg.post("/player character#pc script","heartsync",{hearts})
redraw(self)
end```