How to access the Windows registry?
Have a look here.
Otherwise, use LuaCOM:
> require 'luacom'
> sh = luacom.CreateObject "WScript.Shell"
> = sh:RegRead "HKCU\\Console\\ColorTable01"
8388608
See the Microsoft Article for more details. This is also the easiest way to get network drives and connected printers, for instance.
Winapi has functions to read and write to the registry.