lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2009/1/8 Linker <linker.m.lin@gmail.com>:
> On Thu, Jan 8, 2009 at 19:04, Jerome Vuarand <jerome.vuarand@gmail.com>
> wrote:
>>
>> 2009/1/7 Linker <linker.m.lin@gmail.com>:
>>> require'CLRPackage'
>>> module('registry',package.seeall)
>>>
>>>
>>> import'mscorlib.dll'
>>> import'Microsoft.Win32'
>>> local o=import'Microsoft.Win32.Registry.LocalMachine.OpenSubKey'
>>>
>>>
>>> function is_mssqle_installed()
>>> local key = Registry( "Software\\Microsoft\\Microsoft SQL Server\\",
>>> false
>>> )--??It doesn't work.  :(
>>> print(key)
>>> return true
>>> end
>>> is_mssqle_installed()
>>
>> Maybe we can help you find the problem if you give us a more
>> meaningful error report. "It doesn't work." is not very informative.
>
> Sorry,this is the error msg:
> lua: can't find constructor to match arguments
> stack traceback:
> [C]: in function 'Registry'
> testdotnet.lua:16: in function 'is_mssqle_installed'
> testdotnet.lua:21: in main chunk
> [C]: ?

That's because the Registry class [1] has no constructor. It appears
that the OpenSubKey function [2] (that you save in o) takes a string
and a boolean as arguments. So I guess that instead of:

  local key = Registry("Software\\Microsoft\\Microsoft SQL Server\\",
false )--??It doesn't work.  :(

what you meant is probably:

  local key = o("Software\\Microsoft\\Microsoft SQL Server\\", false)

[1] http://msdn.microsoft.com/en-us/library/microsoft.win32.registry.aspx
[2] http://msdn.microsoft.com/en-us/library/microsoft.win32.registrykey.opensubkey.aspx