ok, so this it what I originally posted, which apparently seems correct but as AmenMoses pointed out g_Entity only populates for Dynamic entities which I hadn't realised at the time. Also, don't do what I did initially and put the call to the function in the _init section. Must be called within the _main loop section. Doh!
function bigautodoor_main(e,name)
entity_name = name
if entity_name == nil then entity_name = "missing"; end;
state = 0
entities = 0
entities = GetEntityCount()
--entities = g_EntityElementMax
end
...
...
function GetEntityCount()
local result=0
for index in pairs(g_Entity) do
result = result + 1
end
return result
end
Professional Programmer: Languages- SAS (Statistical Analysis Software) , C++, C#, VB, SQL, PL-SQL, JavaScript, HTML, Three.js, Darkbasic Pro (still love this language), Purebasic, others
Hardware: Dell Precision 490; AMD Radeon HD 7570; 12GB.
FPSC to GameGuru Tools: AutoWelder/SegAutoWelder, Entity+Weapon Welder, FPEtoBAT