From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This function returns the unsigned number formed by var value with replacement specified at bits field to field + width - 1


uint bitReplace(uint var, uint replaceValue, int field [, int width = 1])

Required arguments

  • var: The value
  • replaceValue: The replaceValue
  • field: The field number

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • width: Number of bits to extract


Returns the replaced value/bit sequence.


function replaceColorAlpha(color, alpha)
   return bitReplace(color,alpha,24,8) -- return value with replaced bits 24-32 ( the alpha, ) 

See Also