CLua::CLua() { throw_null(state = luaL_newstate()); luaL_openlibs(state); opencv_register(state); // Регистрация биндингов к OpenCV // ############################################################################ // Регистрация функции - обработчика доступа к модулям lua_pushlightuserdata(state, this); lua_pushcclosure(state, CLua::run_module, 1); lua_setglobal(state, "algo"); }
CScriptEngine::CScriptEngine(CContext & ctx, CMeasure & measure, CVectorMap & vector_map) { throw_null(state = luaL_newstate(), "Не удалось инициализировать интерпретатор Lua"); luaL_openlibs(state); opencv_register(state); // Регистрация биндингов к OpenCV auxiliary_register(state); // Регистрация биндингов к дополнительному функционалу context_register(state); // Регистрация биндингов к функционалу, обрабатывающем контекст map_register(state); // Регистрация биндингов к функционалу, управляющему ВММ // ############################################################################ // Регистрация функции - обработчика доступа к модулям lua_pushlightuserdata(state, this); lua_pushlightuserdata(state, & ctx); lua_pushlightuserdata(state, & measure); lua_pushlightuserdata(state, & vector_map); lua_pushcclosure(state, run_module, 4); // TODO Отладить lua_setglobal(state, "algo"); }