lua-users home
lua-l archive

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


On Mon, Feb 28, 2011 at 7:07 PM, King, Mike <MKing@klmicrowave.com> wrote:
> Running the following commands causes an access violation when Sleep returns. What am I doing wrong?  I'm using the latest version of Lua for Windows (v5.1.4-40).
>
> require "alien"
> Sleep = alien.kernel32.Sleep
> Sleep:types('void', 'int')
> Sleep(1000)
>
 Likely because you declare 'Sleep' as 'void(*)(int)', but Sleep
actually takes a DWORD, which is usually typedef'd to 'double'. More
information at MSDN:
http://msdn.microsoft.com/en-us/library/ms686298.aspx

Also, I don't know if that "CONFIDENTIALITY NOTICE" is supposed your
signature or not, but I think it might be a tiny wee bit too long...