1
LUA를 내 프로그램에 luabind
과 통합하는 실험을하고 있지만 큰 걸림돌을 쳤습니다.C++ 11 luabind 통합, 함수 실패
LUA의 호출 규칙에 익숙하지 않아 뭔가 간단하지가 않아. 여기
내 C입니다 ++ 코드 :struct app_t
{
//...
void exit();
void reset();
resource_mgr_t resources;
//...
};
struct resource_mgr_t
{
//...
void prune();
void purge();
//...
};
extern app_t app;
그리고 내 luabind
모듈 :
luabind::module(state)
[
luabind::class_<resource_mgr_t>("resource_mgr")
.def("prune", &resource_mgr_t::prune)
.def("purge", &resource_mgr_t::purge)
];
luabind::module(state)
[
luabind::class_<app_t>("app")
.def("exit", &app_t::exit)
.def("reset", &app_t::reset)
.def_readonly("resources", &app_t::resources)
];
luabind::globals(state)["app"] = &app;
나는 다음과 같은 루아를 실행할 수는 잘 명령 :
app:exit()
app:reset()
을하지만, 다음을 통화가 실패 함 :
다음과 같은 오류와app.resources:purge()
은 :
[string "app.resources:purge()"]:1: attempt to index field 'resources' (a function value)
어떤 도움이 아주 많이 감사합니다!
단지app:reset()
같이
'응용 프로그램 : 자원() : 퍼지()를'지금 오류'luabind 런타임 산출 : property_tag 기능이 called' 할 수 없습니다. –
'app.resources() : purge()'를 시도하십시오. (지금 테스트 할 수 없습니다.) –
동일한 오류가 발생합니다. (필자는 루아 바인드 라이브러리를 다시 빌드해야 할 수도 있습니다. (http://www.gamedev.net/topic/593408-def-readwrite-dosent-work /) 나는가 프로그램을 컴파일하지 못하게하는 등의 이상한 오류가 발생했다. –