Simple function, Probably stupid mistake

Hey guys,

Made a supposed to be simple function for working out “hunger”

But apparently does not work:

function hungernew(hunger)
        local hungerreal = 0.8/#hunger
        return #hungerreal

Error I get is:

attempt to get length of local ‘hunger’ (a number value)

Any help would be greatly appreciated and welcome since it all adds to my knowledge of Lua and Gmod.

P.S Sorry but don’t seem to know how to show the function better than that :stuck_out_tongue:

Like the error says, you are trying to get the length (#) of a number value, remove the # in front of hunger.


And the one in front of hungerreal.

Thanks, It worked!