luaengine: add emu_file::write, enables the use of sockets and pipes from lua without needing a third party library (nw)

This commit is contained in:
cracyc 2017-03-20 13:11:00 -05:00
parent 6db02810e4
commit b4fc8d8c38

View File

@ -778,6 +778,7 @@ void lua_engine::initialize()
emu.new_usertype<emu_file>("file", sol::call_constructor, sol::constructors<sol::types<const char *, uint32_t>>(),
"read", [](emu_file &file, sol::buffer *buff) { buff->set_len(file.read(buff->get_ptr(), buff->get_len())); return buff; },
"write", [](emu_file &file, const std::string &data) { return file.write(data.data(), data.size()); },
"open", static_cast<osd_file::error (emu_file::*)(const std::string &)>(&emu_file::open),
"open_next", &emu_file::open_next,
"seek", &emu_file::seek,