Re: Expose functions in need?

Nigel Atkinson <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <1276077853.1917.14.camel@ankh>
Hi,

Short answer: yes.

Do you really have 500+ in one class?!?!  Anyhow, you could create
several similar functions that register a different set of functions and
call one depending on which set your script your needs.

Another option: You can also split bindings up (see the docs) - which
you could switch in and out with if statements.

Nigel

On Wed, 2010-06-09 at 17:23 +0800, ZouYabin wrote:
> Hi all, 
>        I am asking if luabind can expose functions when the lua script
> file really needs?
> Now I have 500+ functions, but not every lua file need all the
> functions, mostly, each lua file
> will only call a few (< 10) of them. 
>       My luabind module is like this:
>     luabind::module(L)
>     [ 
>        luabind:class_<MyClass>("MyClass")
>        .def(luabind:constructor<>())
>        .def("Func1", &MyClass:Func1)
>        .def("Func2", &MyClass:Func2)
>         ...
>         ...
>   
>        .def("Func500", &MyClass:Func500)
>     ];
> My Application has about 2000 lua files, each one owns a seperate
> lua_State. Before load the lua file, I will register the module above
> to each lua_State. Now the problem is that it seems kinda a waste
> registering 500 functions for 
> each lua_State. Is there any way to just register functions needed
> indeed? 
>  
> Regards
> Albin
>  
>  
>  
> 
> 
> 
> ______________________________________________________________________
> 网易为中小企业免费提供企业邮箱(自主域名)
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate 
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
> lucky parental unit.  See the prize list and enter to win: 
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________ luabind-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/luabind-user



------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.