Jump to content

Coverting number into a decimal expected string got nill


..:D&G:..

Recommended Posts

Hello, I want to convert a number into a number with commas, but I keep getting the error string expected got nill...

function transformaNumar( theNumber )   
    local numaruldefacut = theNumber   
    while true do       
        numaruldefacut , p = string.gsub(numaruldefacut , "^(-?%d+)(%d%d%d)", "%1,%2")     
    if (p==0) then       
        break    
        end   
    end   
    return numaruldefacut  
end 

Link to comment

Might help though.

function transformaNumar( theNumber )   
    local numaruldefacut = theNumber   
    while true do       
        if not (numaruldefacut == tostring(numaruldefacut)) then -- If it's not the string right now 
          break -- Stop it 
        end 
        numaruldefacut , p = string.gsub(numaruldefacut , "^(-?%d+)(%d%d%d)", "%1,%2")     
        if (p==0) then       
          break   
        end   
    end   
    return numaruldefacut 
end 

Link to comment

It worked thx :D

So I don't make another post... I will post here

function esteJucatorulAdmin( thePlayer ) 
    if ( isElement( thePlayer ) ) then 
        local iaStatusulStaffului = getElementData(thePlayer, "esteJucatorulAdmin") 
        if ( iaStatusulStaffului ) then 
            return true 
        else 
            return false 
        end 
    else 
        return false 
    end 
end 

else 
            return false 
        end 

The 'return false': attempt to concatenate a boolean value

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...