register all classes at once in LUA environment
This commit is contained in:
		
							parent
							
								
									1508874ebc
								
							
						
					
					
						commit
						426374ff8a
					
				@ -56,26 +56,24 @@ void ScriptingEnvironment::initLuaState(lua_State* lua_state)
 | 
			
		||||
    luabind::module(lua_state)[
 | 
			
		||||
        luabind::def("print", LUA_print<std::string>),
 | 
			
		||||
        luabind::def("durationIsValid", durationIsValid),
 | 
			
		||||
        luabind::def("parseDuration", parseDuration)
 | 
			
		||||
    ];
 | 
			
		||||
        luabind::def("parseDuration", parseDuration),
 | 
			
		||||
 | 
			
		||||
    luabind::module(lua_state)[luabind::class_<HashTable<std::string, std::string>>("keyVals")
 | 
			
		||||
        luabind::class_<HashTable<std::string, std::string>>("keyVals")
 | 
			
		||||
        .def("Add", &HashTable<std::string, std::string>::Add)
 | 
			
		||||
        .def("Find", &HashTable<std::string, std::string>::Find)
 | 
			
		||||
                                    .def("Holds", &HashTable<std::string, std::string>::Holds)];
 | 
			
		||||
        .def("Holds", &HashTable<std::string, std::string>::Holds),
 | 
			
		||||
 | 
			
		||||
    luabind::module(lua_state)[luabind::class_<ImportNode>("Node")
 | 
			
		||||
                                    .def(luabind::constructor<>())
 | 
			
		||||
        luabind::class_<ImportNode>("Node")
 | 
			
		||||
        // .def(luabind::constructor<>())
 | 
			
		||||
        .def_readwrite("lat", &ImportNode::lat)
 | 
			
		||||
        .def_readwrite("lon", &ImportNode::lon)
 | 
			
		||||
        .def_readonly("id", &ImportNode::node_id)
 | 
			
		||||
        .def_readwrite("bollard", &ImportNode::bollard)
 | 
			
		||||
        .def_readwrite("traffic_light", &ImportNode::trafficLight)
 | 
			
		||||
                                    .def_readwrite("tags", &ImportNode::keyVals)];
 | 
			
		||||
        .def_readwrite("tags", &ImportNode::keyVals),
 | 
			
		||||
 | 
			
		||||
    luabind::module(lua_state)
 | 
			
		||||
        [luabind::class_<ExtractionWay>("Way")
 | 
			
		||||
             .def(luabind::constructor<>())
 | 
			
		||||
       luabind::class_<ExtractionWay>("Way")
 | 
			
		||||
        // .def(luabind::constructor<>())
 | 
			
		||||
        .def_readonly("id", &ExtractionWay::id)
 | 
			
		||||
        .def_readwrite("name", &ExtractionWay::name)
 | 
			
		||||
        .def_readwrite("speed", &ExtractionWay::speed)
 | 
			
		||||
@ -93,13 +91,10 @@ void ScriptingEnvironment::initLuaState(lua_State* lua_state)
 | 
			
		||||
            luabind::value("oneway", 1),
 | 
			
		||||
            luabind::value("bidirectional", 2),
 | 
			
		||||
            luabind::value("opposite", 3)
 | 
			
		||||
             ]];
 | 
			
		||||
 | 
			
		||||
    // fails on c++11/OS X 10.9
 | 
			
		||||
    luabind::module(lua_state)[luabind::class_<std::vector<std::string>>("vector").def(
 | 
			
		||||
        "Add",
 | 
			
		||||
        static_cast<void (std::vector<std::string>::*)(const std::string &)>(
 | 
			
		||||
            &std::vector<std::string>::push_back))];
 | 
			
		||||
        ],
 | 
			
		||||
        luabind::class_<std::vector<std::string>>("vector")
 | 
			
		||||
        .def("Add", static_cast<void (std::vector<std::string>::*)(const std::string &)>(&std::vector<std::string>::push_back))
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    if (0 != luaL_dofile(lua_state, file_name.c_str()))
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user