• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

New to LUA, does this leak?

Status
Not open for further replies.
Level 6
Joined
Jul 21, 2020
Messages
67
Hey, so I'm fairly new to Lua and I created this unit spawning script for my map and it seems like my map keeps crashing around the same time every time I launch it. This is my first foray into Lua so I'm not super sure the things that I need to look out for or do to make sure that I'm not leaking. Let me know if you guys have any advice to give. Thanks!

Lua:
function init_SpawnClass()

-- Create the table for the class definition
spawn = {}

-- Define the new() function
spawn.new = function()
local self = {}

self.bases = {}

function self.addBase(baseName, alliedStart, alliedEnd, alliedCondition, fedStart, fedEnd, fedCondition, destination)

-- Add all of the info the base and add the base name to the base list
self[baseName] = {allied = {startPoint = alliedStart, endPoint = alliedEnd, condition = alliedCondition}, fed = {startPoint = fedStart, endPoint = fedEnd, condition = fedCondition}, destination = destination, units = {}}
table.insert( self.bases, baseName )
end

function self.baseCount()
return #self.bases
end


function self.unitCount( baseName )
return #self[baseName].units
end


function self.unitInWave( baseName, unitIndex, waveNumber)
local waves = self[baseName].units[unitIndex].waves

for index, value in ipairs(waves) do
if value == waveNumber then
return true
end
end

return false
end


function self.unitInLevel(baseName, unitIndex, levelNumber)
local levelStart, levelEnd = self[baseName].units[unitIndex].level[1], self[baseName].units[unitIndex].level[2]

if (levelNumber >= levelStart and levelNumber <= levelEnd) then
return true
end

return false
end



function self.baseAlive(baseName)

local alliedBaseAlive = IsUnitAliveBJ(self[baseName].allied.condition)
local fedBaseAlive = IsUnitAliveBJ(self[baseName].fed.condition)

--local alliedBaseAlive = true
--local fedBaseAlive = true


return alliedBaseAlive, fedBaseAlive
end


function self.checkSpawnUnit(baseName, unitIndex, levelNumber, waveNumber)
local alliedBaseAlive, fedBaseAlive = self.baseAlive(baseName)
local unitInWave = self.unitInWave(baseName, unitIndex, waveNumber)
local unitInLevel = self.unitInLevel(baseName, unitIndex, levelNumber)
local numOfUnits = self[baseName].units[unitIndex].numOfUnits
local unitType = self[baseName].units[unitIndex].unitType

if unitInWave and unitInLevel then
return alliedBaseAlive, fedBaseAlive, numOfUnits, unitType
else
return false, false, numOfUnits, unitType
end
end

function self.addUnit(baseName, unitType, numOfUnits, waves, levelStart, levelEnd)
table.insert( self[baseName].units, {unitType=unitType, numOfUnits=numOfUnits, waves=waves, level={levelStart, levelEnd}} )
end


function self.spawnUnits(baseName, levelNumber, waveNumber)

local pStart
local pDest
local allied = false
local fed = false
local lcu
local unitType
local numOfUnits

for unitI=1,self.unitCount(baseName) do
allied, fed, numOfUnits, unitType = self.checkSpawnUnit(baseName, unitI, levelNumber, waveNumber)

if allied then

for i=1,numOfUnits do
pStart = GetRandomLocInRect(self[baseName].allied.startPoint)
pDest = GetRandomLocInRect(self[baseName].allied.endPoint)

lcu = CreateUnitAtLoc(Player(GetRandomInt(18, 20)), FourCC(unitType), pStart, bj_UNIT_FACING)
SetUnitUserData(lcu, self[baseName].destination)
IssuePointOrderLoc(lcu, "attack", pDest)

RemoveLocation(pStart)
RemoveLocation(pDest)
end
end

if fed then

for i=1,numOfUnits do
pStart = GetRandomLocInRect(self[baseName].fed.startPoint)
pDest = GetRandomLocInRect(self[baseName].fed.endPoint)

lcu = CreateUnitAtLoc(Player(GetRandomInt(21, 23)), FourCC(unitType), pStart, bj_UNIT_FACING)
SetUnitUserData(lcu, self[baseName].destination)
IssuePointOrderLoc(lcu, "attack", pDest)

RemoveLocation(pStart)
RemoveLocation(pDest)
end

end
end
end

return self
end
end

function spawnSetup()

-- Set up variables
spawnTimer = CreateTimer()
baseSpawn = spawn.new()
spawnWave = 1
spawnBaseI = 0

cycleInterval = 3.50
baseInterval = 0.4
waveInterval = 15.00

-- addBase(baseName, alliedStart, alliedEnd, alliedCondition, fedStart, fedEnd, fedCondition, destination)
baseSpawn.addBase("arcane", gg_rct_Left_Arcane, gg_rct_Right_Start_Bottom, gg_unit_h003_0015, gg_rct_Right_Arcane, gg_rct_Left_Start_Top, gg_unit_h003_0007, 3)
baseSpawn.addBase("arcaneCreep", gg_rct_Left_Arcane, gg_rct_Left_Elemental_Start, gg_unit_h003_0015, gg_rct_Right_Arcane, gg_rct_Right_Elemental_Start, gg_unit_h003_0007, 7)
baseSpawn.addBase("arcaneHero", gg_rct_Arcane_Hero_Left, gg_rct_Right_Start_Bottom, gg_unit_hars_0017, gg_rct_Arcane_Hero_Right, gg_rct_Left_Start_Top, gg_unit_hars_0158, 3)
baseSpawn.addBase("arcaneTop", gg_rct_Arcane_Left_Top, gg_rct_Right_Start_Bottom, gg_unit_hars_0355, gg_rct_Arcane_Right_Top, gg_rct_Left_Start_Top, gg_unit_hars_0293, 3)
baseSpawn.addBase("arcaneBottom", gg_rct_Arcane_Left_Bottom, gg_rct_Right_Start_Bottom, gg_unit_hars_0292, gg_rct_Arcane_Right_Bottom, gg_rct_Left_Start_Top, gg_unit_hars_0303, 3)
baseSpawn.addBase("blacksmith", gg_rct_Blacksmith_Left, gg_rct_Right_Start, gg_unit_n00K_0802, gg_rct_Blacksmith_Right, gg_rct_Left_Start, gg_unit_n00K_0477, 2)
baseSpawn.addBase("blacksmithCreep", gg_rct_Blacksmith_Left, gg_rct_Zombie_End_Left, gg_unit_n00K_0802, gg_rct_Blacksmith_Right, gg_rct_Zombie_End_Right, gg_unit_n00K_0477, 10)
baseSpawn.addBase("castle", gg_rct_Left_Hero, gg_rct_Right_Start, gg_unit_hvlt_0207, gg_rct_Right_Hero, gg_rct_Left_Start, gg_unit_hvlt_0406, 2)
baseSpawn.addBase("cityElves", gg_rct_City_Elves_Left, gg_rct_Right_Start, gg_unit_h00E_0033, gg_rct_City_Elves_Right, gg_rct_Left_Start, gg_unit_h00E_0081, 2)
baseSpawn.addBase("cityFront", gg_rct_Front_Town_Left, gg_rct_Right_Start, gg_unit_n00B_0364, gg_rct_Front_City_Right, gg_rct_Left_Start, gg_unit_n00B_0399, 2)
baseSpawn.addBase("citySide", gg_rct_Left_City, gg_rct_Right_Start, gg_unit_n00B_0102, gg_rct_Right_City, gg_rct_Left_Start, gg_unit_n00B_0038, 2)
baseSpawn.addBase("furbolg", gg_rct_Furbolg_Left, gg_rct_Right_Start_Top, gg_unit_n00D_0003, gg_rct_Furbolg_Right, gg_rct_Left_Start_Bottom, gg_unit_n00D_0091, 1)
baseSpawn.addBase("highElves", gg_rct_Left_High_Elves, gg_rct_Right_Start_Top, gg_unit_nheb_0109, gg_rct_Right_High_Elves, gg_rct_Left_Start_Bottom, gg_unit_nheb_0036, 1)
baseSpawn.addBase("highElvesCreep", gg_rct_Left_High_Elves, gg_rct_Aspect_of_Forest_Left, gg_unit_nheb_0109, gg_rct_Right_High_Elves, gg_rct_Aspect_of_Forest_Right, gg_unit_nheb_0036, 9)
baseSpawn.addBase("merc", gg_rct_Camp_Bottom, gg_rct_Right_Start_Bottom, gg_unit_n001_0048, gg_rct_Camp_Top, gg_rct_Left_Start_Top, gg_unit_n001_0049, 3)
baseSpawn.addBase("mine", gg_rct_Left_Workshop, gg_rct_Right_Start_Bottom, gg_unit_h006_0074, gg_rct_Right_Workshop, gg_rct_Left_Start_Top, gg_unit_h006_0055, 3)
baseSpawn.addBase("naga", gg_rct_Naga_Left, gg_rct_Right_Start_Top, gg_unit_nntt_0135, gg_rct_Naga_Right, gg_rct_Left_Start_Bottom, gg_unit_nntt_0132, 1)
baseSpawn.addBase("nagaCreep", gg_rct_Naga_Left, gg_rct_Murloc_Left, gg_unit_nntt_0135, gg_rct_Naga_Right, gg_rct_Murloc_Right, gg_unit_nntt_0132, 8)
baseSpawn.addBase("nightElves", gg_rct_Left_Tree, gg_rct_Right_Start_Top, gg_unit_e003_0058, gg_rct_Right_Tree, gg_rct_Left_Start_Bottom, gg_unit_e003_0014, 1)
baseSpawn.addBase("orc", gg_rct_Left_Orc, gg_rct_Right_Start_Top, gg_unit_o001_0075, gg_rct_Right_Orc, gg_rct_Left_Start_Bottom, gg_unit_o001_0078, 1)
baseSpawn.addBase("shipyard", gg_rct_Left_Shipyard, gg_rct_Right_Start_Top, gg_unit_eshy_0120, gg_rct_Right_Shipyard, gg_rct_Left_Start_Bottom, gg_unit_eshy_0047, 1)
baseSpawn.addBase("town", gg_rct_Left_Forward_Camp, gg_rct_Right_Start_Bottom, gg_unit_h00F_0029, gg_rct_Right_Forward, gg_rct_Left_Start_Top, gg_unit_h00F_0066, 3)

-- addUnit(baseName, unitType, numOfUnits, {waves}, levelStart, levelEnd)

-- Arcane Spawn
baseSpawn.addUnit("arcane", "h00C", 2, {5,6,7,8,9}, 3, 12) -- Sorcress
baseSpawn.addUnit("arcane", "hgry", 1, {2,4,6,8,10}, 10, 12) -- Gryphon Rider

-- Arcane Creep Spawn
baseSpawn.addUnit("arcaneCreep", "narg", 2, {1,2,3,4}, 2, 12) -- Battle Golem
baseSpawn.addUnit("arcaneCreep", "hwt2", 1, {1,2,3,4}, 3, 12) -- Water Elemental (Level 2)
baseSpawn.addUnit("arcaneCreep", "hwt3", 1, {1,2,3,4}, 5, 12) -- Water Elemental (Level 3)
baseSpawn.addUnit("arcaneCreep", "h00K", 1, {1,2,3,4,5,10}, 7, 12) -- Magi Defender

-- Arcane Hero Sapwn
baseSpawn.addUnit("arcaneHero", "n00A", 1, {5,6}, 6, 12) -- Supreme Wizard
baseSpawn.addUnit("arcaneHero", "nsgg", 1, {4,6}, 8, 12) -- Seige Golem

-- Arcane Top Spawn
baseSpawn.addUnit("arcaneTop", "narg", 4, {4,5,6}, 2, 12) -- Battle Golem
baseSpawn.addUnit("arcaneTop", "hwt2", 1, {4,5,6}, 4, 12) -- Water Elemental (Level 2)
baseSpawn.addUnit("arcaneTop", "hwt3", 1, {5,6}, 8, 12) -- Water Elemental (Level 3)

-- Arcane Bottom Spawn
baseSpawn.addUnit("arcaneBottom", "narg", 4, {1,2,3}, 2, 12) -- Battle Golem
baseSpawn.addUnit("arcaneBottom", "hwt2", 1, {1,2,3}, 4, 12) -- Water Elemental (Level 2)
baseSpawn.addUnit("arcaneBottom", "hwt3", 1, {2,3}, 8, 12) -- Water Elemental (Level 3)

-- Blacksmith Spawn
baseSpawn.addUnit("blacksmith", "h011", 2, {1,2,3}, 3, 12) -- Castle Footman
baseSpawn.addUnit("blacksmith", "h00L", 1, {1,2,3,4}, 4, 12) -- Knight
baseSpawn.addUnit("blacksmith", "h00L", 1, {1,2,3,4}, 5, 12) -- Knight
baseSpawn.addUnit("blacksmith", "h012", 1, {1,2,3}, 6, 12) -- Scarlet Commander
baseSpawn.addUnit("blacksmith", "hmtt", 1, {2,3,4}, 6, 12) -- Seige Engine
baseSpawn.addUnit("blacksmith", "hmtm", 1, {3,8}, 7, 12) -- Cannon
baseSpawn.addUnit("blacksmith", "h00D", 1, {2}, 10, 12) -- Commander of the Guard

-- Blacksmith Creep Spawn
baseSpawn.addUnit("blacksmithCreep", "h007", 4, {1,2,3,4}, 1, 5) -- Militia
baseSpawn.addUnit("blacksmithCreep", "nhea", 1, {1,2,3,4,5}, 3, 12) -- Archer
baseSpawn.addUnit("blacksmithCreep", "hspt", 1, {1,2,3,4}, 4, 12) -- Tower Guard
baseSpawn.addUnit("blacksmithCreep", "h012", 2, {1,2,3,4,5}, 5, 12) -- Scarlet Commander
baseSpawn.addUnit("blacksmithCreep", "hcth", 2, {1,2,3,4,5}, 6, 12) -- Captian

-- Castle Spawn
baseSpawn.addUnit("castle", "hspt", 1, {1,2,3,4,5,6,7,8}, 2, 3) -- Tower Guard
baseSpawn.addUnit("castle", "hspt", 2, {1,2,3,4,5,6,7,8}, 4, 5) -- Tower Guard
baseSpawn.addUnit("castle", "hspt", 3, {1,2,3,4,5,6,7,8}, 6, 12) -- Tower Guard
baseSpawn.addUnit("castle", "h00s", 1, {1,2,3,4,5,6,7,8}, 8, 12) -- Commander

-- City Elves
baseSpawn.addUnit("cityElves", "nhea", 1, {1,2,3,4,5,6}, 1, 3) -- Archer
baseSpawn.addUnit("cityElves", "nchp", 1, {1,2,3,4}, 3, 6) -- Mystic
baseSpawn.addUnit("cityElves", "nhea", 1, {1,2,3,4,5,6,7,8,9,10}, 4, 12) -- Archer
baseSpawn.addUnit("cityElves", "nchp", 1, {1,2,3,4,5,6,7}, 7, 12) -- Mystic

-- City Front Spawn
baseSpawn.addUnit("cityFront", "h007", 2, {2,3,4,5,6,7}, 1, 2) -- Militia
baseSpawn.addUnit("cityFront", "h007", 4, {2,3,4,5,6,7}, 3, 12) -- Militia
baseSpawn.addUnit("cityFront", "hfoo", 3, {2,3,4,5,6,7}, 4, 12) -- Footman
baseSpawn.addUnit("cityFront", "hcth", 2, {2,3,4,5,6}, 6, 12) -- Captian

-- City Side Spawn
baseSpawn.addUnit("citySide", "h007", 1, {6,7,8,9,10}, 1, 2) -- Militia
baseSpawn.addUnit("citySide", "hfoo", 2, {6,7,8,9,10}, 2, 12) -- Footman
baseSpawn.addUnit("citySide", "h007", 2, {6,7,8,9,10}, 3, 12) -- Militia

-- Furbolg Spawn
baseSpawn.addUnit("furbolg", "n00E", 2, {3,4,5,6,7,8}, 1, 12) -- Furbolg
baseSpawn.addUnit("furbolg", "n00G", 1, {5,6,7,8}, 3, 12) -- Furbolg Shaman
baseSpawn.addUnit("furbolg", "n00E", 2, {6,7,8,9,10}, 4, 12) -- Furbolg


-- High Elves
baseSpawn.addUnit("highElves", "nhea", 2, {1,2,3,4,5}, 1, 12) -- Archer
baseSpawn.addUnit("highElves", "e000", 1, {1,2,3,4,5,6,7,8}, 2, 12) -- Ranger
baseSpawn.addUnit("highElves", "hhes", 4, {1,2,3,4}, 4, 12) -- Swordsman
baseSpawn.addUnit("highElves", "nemi", 1, {1,2,3,4,5,6}, 5, 12) -- Emmisary

-- High Elves Creep
baseSpawn.addUnit("highElvesCreep", "hhes", 2, {1,2,3,4}, 1, 12) -- Swordsman
baseSpawn.addUnit("highElvesCreep", "nhea", 1, {1,2,3,4,5}, 2, 12) -- Archer
baseSpawn.addUnit("highElvesCreep", "nemi", 1, {1,2,3,4}, 4, 12) -- Emmisary
baseSpawn.addUnit("highElvesCreep", "h010", 2, {1,2,3,4}, 6, 12) -- Elven Guardian

-- Merc Spawn
baseSpawn.addUnit("merc", "n002", 2, {1,2,3,4,5,6,7,8,9,10}, 1, 12) -- Merc
baseSpawn.addUnit("merc", "n003", 2, {4,5,6,7,8,9,10}, 2, 12) -- Merc Archer
baseSpawn.addUnit("merc", "n002", 2, {7,8,9,10}, 3, 12) -- Merc
baseSpawn.addUnit("merc", "n008", 3, {7,8,9,10}, 4, 12) -- Enforcer
baseSpawn.addUnit("merc", "nass", 1, {6,7,8,9,10}, 5, 12) -- Assasin
baseSpawn.addUnit("merc", "n004", 1, {7,8,9,10}, 1, 12) -- Wizard Warrior
baseSpawn.addUnit("merc", "n005", 1, {7,8,9,10}, 6, 12) -- Bandit Lord

-- Mine Spawn
baseSpawn.addUnit("mine", "h001", 1, {2,3,4,5,6}, 2, 12) -- Morter Team
baseSpawn.addUnit("mine", "h008", 3, {1,2,3,4,5,6,7,8}, 3, 12) -- Rifleman
baseSpawn.addUnit("mine", "ncg2", 2, {1,2,3,4,5}, 4, 12) -- Clockwerk Goblin
baseSpawn.addUnit("mine", "n00F", 1, {2,3,4,5,6,7}, 5, 12) -- Automaton

-- Naga Spawn
baseSpawn.addUnit("naga", "nmyr", 1, {1,2,3,4,5,6,7,8,9,10}, 1, 12) -- Naga Myrmidon
baseSpawn.addUnit("naga", "nnsw", 1, {4,5,6,7,8,9,10}, 2, 12) -- Naga Siren
baseSpawn.addUnit("naga", "nnrg", 1, {5,6,7,8,9,10}, 5, 12) -- Naga Royal Guard
baseSpawn.addUnit("naga", "nhyc", 1, {1,3,5,7,8,9,10}, 9, 12) -- Dragon Turtle

-- Naga Creep Spawn
baseSpawn.addUnit("nagaCreep", "nmyr", 2, {1,2,3,4}, 2, 12) -- Naga Myrmidon
baseSpawn.addUnit("nagaCreep", "nnsw", 1, {2,3,4,5}, 3, 12) -- Naga Siren
baseSpawn.addUnit("nagaCreep", "nsnp", 1, {2,3,4,5}, 6, 12) -- Snap Dragon

-- Night Elves Spawn
baseSpawn.addUnit("nightElves", "nwat", 1, {1,2,3,4,5,6,7}, 2, 12) -- Sentry
baseSpawn.addUnit("nightElves", "edry", 1, {1,2,3,4,5}, 3, 12) -- Dryad
baseSpawn.addUnit("nightElves", "edoc", 2, {1,2,3,4,5}, 4, 12) -- Druid of the Claw
baseSpawn.addUnit("nightElves", "e005", 1, {1,3,5}, 5, 12) -- Mountain Giant
baseSpawn.addUnit("nightElves", "echm", 1, {2,4}, 9, 12) -- Chimera

-- Orc Spawn
baseSpawn.addUnit("orc", "o002", 2, {4,5,6,7,8,9,10}, 1, 12) -- Grunt
baseSpawn.addUnit("orc", "o002", 2, {8,9,10}, 3, 12) -- Grunt
baseSpawn.addUnit("orc", "nftr", 2, {6,7,8,9,10}, 2, 12) -- Spearman
baseSpawn.addUnit("orc", "nogr", 3, {1,6,8,10}, 4, 12) -- Ogre
baseSpawn.addUnit("orc", "o004", 1, {6,7,8}, 3, 12) -- Spirit Walker
baseSpawn.addUnit("orc", "nogm", 1, {1,6,8}, 4, 12) -- Ogre Warchief
baseSpawn.addUnit("orc", "otau", 1, {5,6,7}, 5, 12) -- Tauren

-- Shipyard Spawn
baseSpawn.addUnit("shipyard", "edes", 1, {1,2}, 1, 2) -- Night Elf Frigate
baseSpawn.addUnit("shipyard", "edes", 1, {1,2,3,4}, 3, 4) -- Night Elf Frigate
baseSpawn.addUnit("shipyard", "edes", 1, {1,2,3,4,5,6}, 5, 12) -- Night Elf Frigate

-- Town Spawn
baseSpawn.addUnit("town", "h007", 3, {6,7,8,9,10}, 1, 5) -- Militia
baseSpawn.addUnit("town", "hcth", 1, {2,6,8,10}, 2, 12) -- Captian
baseSpawn.addUnit("town", "hfoo", 6, {1,7,8,9,10}, 3, 12) -- Footman
baseSpawn.addUnit("town", "h00L", 2, {1,3,7,9}, 4, 12) -- Knight


--DisplayTextToForce(GetPlayersAll() , "Spawn Setup")
StartTimerBJ(spawnTimer, false, 10)
end




function spawnRun()

trg_spawnRun = CreateTrigger()
TriggerRegisterTimerExpireEventBJ(trg_spawnRun, spawnTimer)

TriggerAddAction(trg_spawnRun, function ()

-- Iterate everything up
spawnBaseI = spawnBaseI + 1

if (spawnBaseI > baseSpawn.baseCount() ) then
spawnBaseI = 0
spawnWave = spawnWave + 1

if spawnWave > 10 then
spawnWave = 1
StartTimerBJ(spawnTimer, false, cycleInterval)
else
StartTimerBJ(spawnTimer, false, waveInterval)
end

return true
else
StartTimerBJ(spawnTimer, false, baseInterval)
end


-- Find the Base to Spawn Next
local baseName = baseSpawn.bases[spawnBaseI]

-- Spawn the Units at the selected Base
DisableTrigger(gg_trg_Creeps_keep_going_after_Order)
baseSpawn.spawnUnits(baseName, udg_INTcreepLevel, spawnWave)
EnableTrigger(gg_trg_Creeps_keep_going_after_Order)
end)
end


-- Classes
init_SpawnClass()

-- Spawn
spawnSetup()
spawnRun()
 
Last edited:
Level 17
Joined
Apr 27, 2008
Messages
2,455
i haven't checked about leaks (boring to read code on phone)
but i i noticed your new method doesn't return anything.
also instead of using several functions arguments you could use 1 single table with fields, so you don't have to worry about the order of arguments when you call the function, and it's less buggy prone, in the sense that it won't tell you if you had bad arguments type for function, having to spell them force you to be more attentive.

anyway lua garbage collector doesn't handle userdata type (every jass type but not string,boolean,real,integer and maybe i forget a few)
technically the gc might even never collect garbage depending how is the setup and how the memory used by Warcraft evolves.
in other words, you still have to worry about the same leaks than before, such as locations, groups and so one.
but there is a way for them, you can check DSG post about getting rid of leaks posted on this section

what the GC handles by itself is when you create a table and there is no more reference left to it, it will be destroyed when the gc will collect garbage

you can also check about weak table

the lua tag is [c.ode=lua][/code], without the dot "."
 
Last edited:
Level 17
Joined
Apr 27, 2008
Messages
2,455
you can store anything (including a table) in a lua table (as key and/or value).
Nested tables as well, whatever.
You just can't store the nil type (as a key and/or value) without extra stuff.

just set your table to nil, or the entry of it you want to delete (assuming all objects referenced on the list are already destroyed).

However apparently handles id are not in sync, so the loop through a table using pairs with handles as keys, can be different on each player computer.

lua and unit data
 
Last edited:
Status
Not open for further replies.
Top