# Union length operator

The length operator # applied on a Union object returns the size in bytes of the union in memory.

Notes

  • The length operator returns the same result as the Union.size property.

Example

local c = require "c" -- Creates a LARGE_INTEGER C union definition from Windows API, with a struct field local LARGE_INTEGER = c.Union(".l", { Part = c.Struct("Ii", "Low", "High") }, "QuadPart") -- prints 'true' print(LARGE_INTEGER.size == #LARGE_INTEGER)