NumToHex

From GECK
Jump to: navigation, search


A function added by the New Vegas Script Extender.

Description

Converts a specified integer to a hexadecimal string, optionally padded to the specified width.

If the specified width is smaller than the minimum width to represent the number, will use the minimum width.

The maximum width is 8 characters.

If AddPrefix is set to true (non-zero), will prepend "0x" to the string.

  • This arg is added in xNVSE 6.2.9.

The IntToHex alias was added in xNVSE 6.2.9.

Syntax

[help]
(string) NumToHex ToConvert:int WidthToPadTo:int{8} AddPrefix:bool{0} 

Or:

(string) IntToHex ToConvert:int WidthToPadTo:int{8} AddPrefix:bool{0} 

Example

string_var hex_index

let hex_index := NumToHex 42, 2

; hex_index == "2A"

See Also