Return

Is it possible for a function to return a table? or just multiple things? like, when i call a function, i want it to return 3 entities. How can i do this?

You can do both:

[lua]function returnTable( )

return { "This", "is", "a", "table" }

end[/lua]

[lua]function returnMultiple( )

return "This", "is", "not", "a", "table"

end[/lua]

[editline]08:01PM[/editline]

In you case you can just return three entities and store them in three variables, like this:
[lua]function EntityReturn( )

return ent1, ent2, ent3

end

local a, b, c = EntityReturn( )[/lua]

oh, Great!! Thanks!

Multiple assignment is really cool.
In addition, you can place a table’s values directly into variables using unpack…

[lua]

MyTable = { ‘some’, ‘data’, 1, 2, 3 }
a,b,c,d,e = unpack( MyTable )

– some functions support an arbitrary number of arguments, so you can do things like…
print( a,b,c,d,e )
>> some data 1 2 3

– and directly swap the values of variables…
a,b = b,a
c,d,e = e,c,d

print( a,b,c,d,e )
>> data some 3 1 2

[/lua]