Lua:getFileVersion
Jump to navigation
Jump to search
<> Reference
function getFileVersion(pathtofile) : integer, table
Returns the 64-bit file version of the specified file, as well as a table containing the version split into separate fields.
The returned table contains the major, minor, release, and build parts of the file version.
Function Parameters[edit]
| Parameter | Type | Description |
|---|---|---|
| pathtofile | String | The path to the file whose version information should be retrieved. |
Returns[edit]
integer, table — The 64-bit file version, followed by a table containing the split version fields.
Return Table Fields[edit]
| Field | Type | Description |
|---|---|---|
| major | Integer | The major version number. |
| minor | Integer | The minor version number. |
| release | Integer | The release version number. |
| build | Integer | The build version number. |
Examples[edit]
local version, versionInfo = getFileVersion("C:\\\\Windows\\\\System32\\\\kernel32.dll")
print("Version: " .. tostring(version))
if versionInfo ~= nil then
print("Major: " .. tostring(versionInfo.major))
print("Minor: " .. tostring(versionInfo.minor))
print("Release: " .. tostring(versionInfo.release))
print("Build: " .. tostring(versionInfo.build))
end
local version, versionInfo = getFileVersion("C:\\\\Windows\\\\System32\\\\kernel32.dll")
if versionInfo ~= nil then
local versionString = string.format(
"%d.%d.%d.%d",
versionInfo.major,
versionInfo.minor,
versionInfo.release,
versionInfo.build
)
print("File version: " .. versionString)
end
See Also[edit]
Main Pages