Re: Problem when passing a pointer to call_function.
"Thomas Nelson" <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <AB2EF5E39EBB4E008041ED1F636CECEF@Spawn> |
This is just a guess based on what you've sent, but have you exported an
ILoader<> of the appropriate type to Lua? Remember that after the template
compiler finishes there is no relation between template expansions of
different types.
If you have two types, say:
class Foo {}
class Bar {}
You would need something along the lines of:
module(pLState)
[
class_<ILoader<Foo> >("LoaderFoo"),
class_<ILoader<Bar> >("LoaderBar")
];
Alternately you could:
class ILoaderBase {}
template <T> class ILoader: public ILoaderBase {}
module(pLState)
[
class_<ILoaderBase>("Loader")
];
> -----Original Message-----
> From: Teto
>
> Hello,
>
> I'm facing a "assertion failed: crep && your are trying to use an
> unregistered type" policy.hpp line 192" when I tried to call a Lua
> function from C++. I've done many tests and the matter happens when I
> try to pass "loader" as a parameter of the lua function.
>
> ================================
> template<class T>
> bool
> AddLoader(ILoader<T>* loader,std::string extensions)
> {
> luabind::object obj = luabind::globals(
> CGameEngine::GetInstance()->mScript.mLuaState)["AddLoader"];
> if(!(obj && luabind::type(obj) == LUA_TFUNCTION))
> {
> return false;
> }
>
> bool ok = luabind::call_function<bool>(obj,loader,extensions);
> }
> ================================
>
> i'm using luabind 8.* .
>
--
Thomas Nelson [email protected]
--------------------------------------------------------------
"If you still have gas, you're not lost".
- French explorer Pierre Frontage.
(M.Frontage was so influential in the exploration of North America many
roads are still named after him.)
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july