PDA

View Full Version : Lua Registry functions



MMcM
April 21st, 2004, 09:34 PM
Do any of the Lua extension libraries include functions for manipulating the Windows registry, including enumerating keys and values?

If not, perhaps I'll add something to the RegSetValue plug-in.

Promixis
April 22nd, 2004, 03:37 AM
Mike,

Marks's WinLuaEx plugin has registry functions. You can also access the registry using LuaCom.
function RegistryWrite (key,value,type)
-- see MSDN Wscript.Shell RegWrite for documentation
local WshShell
WshShell = luacom_CreateObject("WScript.Shell")
WshShell:RegWrite (key,value,type)
WshShell = nil
collectgarbage ()
end

function RegistryRead (key)
-- see MSDN Wscript.Shell RegRead for documentation
local WshShell,x
WshShell = luacom_CreateObject("WScript.Shell")
x = WshShell:RegRead (key)
WshShell = nil
collectgarbage ()
return x
end

function RegistryDelete (key)
-- see MSDN Wscript.Shell RegRead for documentation
local WshShell,x
WshShell = luacom_CreateObject("WScript.Shell")
x = WshShell:RegDelete (key)
WshShell = nil
collectgarbage ()
end

MMcM
April 22nd, 2004, 07:04 AM
I knew about WScript.Shell; that's why I asked about enumerating keys / values. It sounds like WinLUAEx will do nicely. Thanks.