/gist:fb74c1c0bb61084347c6 Secret
Created
September 17, 2014 18:02
-
-
Save Rapptz/fb74c1c0bb61084347c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <boost/asio.hpp> | |
#include <sol.hpp> | |
namespace asio_sol { | |
void install_io_service(sol::state& lua) { | |
// ways to construct go here through sol::types<...> groups | |
sol::constructors<sol::types<>> ctor; | |
sol::userdata<boost::asio::io_service> io_service( | |
"io_service", ctor, | |
"run", [] (boost::asio::io_service& s) { s.run(); } | |
); | |
auto asio = lua.get<sol::table>("asio"); | |
asio.set_userdata(io_service); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment