Re: Passing extra parameters to wrapper function
Daniel Wallin <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
Kristoffer Danielsson wrote:
> Consider this:
>
> .def("log", WriteLog) // Not sufficient! Need one more parameter...
>
> Inside lua:
>
> log('Hello!')
>
> Wrapper in C++:
>
> void WriteLog(HWND hWndEdit, const char *text)
> {
> SetWindowText(hWndEdit, text); // hWndEdit provided when binding using ".def"?
> }
>
>
> Is this possible? Perhaps using raw()?
You can use tag_function() to explicitly specify the signature of any
function object, so you can for example do this:
def(
"log"
, tag_function<void(char const*)>(
boost::bind(WriteLog, edit_hwdn, _1)
)
);
--
Daniel Wallin
BoostPro Computing
http://www.boostpro.com
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com