'LinKin Posted November 21, 2013 Share Posted November 21, 2013 Hello, I've a custom function to return the a player by sending it a part of its nick. But, I was wondering if it is possible to return more than one argument in my function, I mean: Return the player, but, if there are more than one (1) players with the same part of the nick, I want to return false & the number of players who have that part of the nick. If this is not possible, Would it be right if I return different types of elements in the same function? Example: if matches == 0 then return false elseif matches == 1 then return thePlayer elseif matches > 1 then return matches (*) end (*): Would return a number Link to comment
arezu Posted November 22, 2013 Share Posted November 22, 2013 You can return multiple values in lua and with different types. For example: function f() local player = localPlayer local playersFound = 3 return player, playersFound end local thePlayer, playersFound = f() Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now