Call a function in a shared library: Difference between revisions

→‎{{header|Lua}}: added Lua solution
(→‎{{header|Lua}}: added Lua solution)
Line 1,266:
 
end if</lang>
 
=={{header|Lua}}==
There is no built-in mechanism, but several external library options exist. Here, the alien library is used to display a message box via the Win32 API.
<lang lua>alien = require("alien")
msgbox = alien.User32.MessageBoxA
msgbox:types({ ret='long', abi='stdcall', 'long', 'string', 'string', 'long' })
retval = msgbox(0, 'Please press Yes, No or Cancel', 'The Title', 3)
print(retval) --> 6, 7 or 2</lang>
 
=={{header|Maple}}==
Anonymous user