Jump to content

Question about getElementsWithinColShape


isa_Khamdan

Recommended Posts

Yes!

EXAMPLE:

  
local colShape = createColSphere ( 1, 2, 3, 4 ) 
local players = getElementsWithinColShape ( newcolshape, "player" )   
for theKey,thePlayer in ipairs(players) do                           
    outputChatBox ( getPlayerName ( thePlayer ) .. " is in the col shape." )   
end 
  
--I Have got this example from wiki . 
  

Link to comment
Or do a variable, count = 0 before the loop then count = count + 1 inside.

True, but it would be a waste of your memory since you only use it for counting.

What if he would like to use the previous count at any other time and I hardly doubt a variable containing max 3 integers will do anything to the memory and if it does you should seriously consider a new host.

Link to comment
  • Moderators

True, but that is just 1 loop.

If you use it in 20 times in one 1 script.

And you have 10 scripts.

And then you have 200 loops and yes that is still nothing for cpu's of these times. (only for players that have bad pc's)

But ask your self: "why write more lines then you need?"

You probably will answer: "I love to write lua....." :)

Link to comment
True, but that is just 1 loop.

If you use it in 20 times in one 1 script.

And you have 10 scripts.

And then you have 200 loops and yes that is still nothing for cpu's of these times. (only for players that have bad pc's)

But ask your self: "why write more lines then you need?"

You probably will answer: "I love to write lua....." :)

Completely off topic but haven't been writing lua in couple of months lol

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...