luaengine: hide stuff that shouldn't be touched directly in registry (nw)

This commit is contained in:
cracyc 2016-11-14 13:51:30 -06:00
parent 388ff83c47
commit 1014a12f52

View File

@ -799,7 +799,7 @@ void lua_engine::initialize()
* thread.yield - check if thread is yielded
*/
sol().new_usertype<context>("thread",
sol().registry().new_usertype<context>("thread",
sol::meta_function::garbage_collect, sol::destructor([](context *ctx) { delete ctx; }),
"start", [this](context &ctx, const char *scr) {
std::string script(scr);
@ -854,7 +854,7 @@ void lua_engine::initialize()
"busy", sol::readonly(&context::busy),
"yield", sol::readonly(&context::yield));
sol().new_usertype<save_item>("item",
sol().registry().new_usertype<save_item>("item",
sol::meta_function::garbage_collect, sol::destructor([](save_item *item) { delete item; }),
"size", sol::readonly(&save_item::size),
"count", sol::readonly(&save_item::count),
@ -916,7 +916,7 @@ void lua_engine::initialize()
* options.entries[] - get table of option entries
*/
sol().new_usertype<core_options>("core_options", "new", sol::no_constructor,
sol().registry().new_usertype<core_options>("core_options", "new", sol::no_constructor,
"help", &core_options::output_help,
"command", &core_options::command,
"entries", sol::property([this](core_options &options) {
@ -948,7 +948,7 @@ void lua_engine::initialize()
* entry.has_range() - are min and max valid for entry
*/
sol().new_usertype<core_options::entry>("core_options_entry", "new", sol::no_constructor,
sol().registry().new_usertype<core_options::entry>("core_options_entry", "new", sol::no_constructor,
"value", sol::overload([this](core_options::entry &e, bool val) {
if(e.type() != OPTION_BOOLEAN)
luaL_error(m_lua_state, "Cannot set option to wrong type");
@ -1015,7 +1015,7 @@ void lua_engine::initialize()
* machine:logerror(str) - print str to log
*/
sol().new_usertype<running_machine> ("machine", "new", sol::no_constructor,
sol().registry().new_usertype<running_machine> ("machine", "new", sol::no_constructor,
"exit", &running_machine::schedule_exit,
"hard_reset", &running_machine::schedule_hard_reset,
"soft_reset", &running_machine::schedule_soft_reset,
@ -1073,7 +1073,7 @@ void lua_engine::initialize()
/* game_driver - this should be self explanatory
*/
sol().new_usertype<game_driver>("game_driver", "new", sol::no_constructor,
sol().registry().new_usertype<game_driver>("game_driver", "new", sol::no_constructor,
"source_file", sol::readonly(&game_driver::source_file),
"parent", sol::readonly(&game_driver::parent),
"name", sol::readonly(&game_driver::name),
@ -1093,7 +1093,7 @@ void lua_engine::initialize()
* device.items[] - device save state items table
*/
sol().new_usertype<device_t>("device", "new", sol::no_constructor,
sol().registry().new_usertype<device_t>("device", "new", sol::no_constructor,
"name", &device_t::name,
"shortname", &device_t::shortname,
"tag", &device_t::tag,
@ -1142,7 +1142,7 @@ void lua_engine::initialize()
return table;
}));
sol().new_usertype<addr_space>("addr_space", sol::call_constructor, sol::constructors<sol::types<address_space &, device_memory_interface &>>(),
sol().registry().new_usertype<addr_space>("addr_space", sol::call_constructor, sol::constructors<sol::types<address_space &, device_memory_interface &>>(),
"read_i8", &addr_space::mem_read<int8_t>,
"read_u8", &addr_space::mem_read<uint8_t>,
"read_i16", &addr_space::mem_read<int16_t>,
@ -1212,7 +1212,7 @@ void lua_engine::initialize()
* ioport.ports[] - ioports table
*/
sol().new_usertype<ioport_manager>("ioport", "new", sol::no_constructor,
sol().registry().new_usertype<ioport_manager>("ioport", "new", sol::no_constructor,
"count_players", &ioport_manager::count_players,
"ports", sol::property([this](ioport_manager &im) {
sol::table port_table = sol().create_table();
@ -1231,7 +1231,7 @@ void lua_engine::initialize()
* port.field[] - get ioport_field table
*/
sol().new_usertype<ioport_port>("ioport_port", "new", sol::no_constructor,
sol().registry().new_usertype<ioport_port>("ioport_port", "new", sol::no_constructor,
"tag", &ioport_port::tag,
"active", &ioport_port::active,
"live", &ioport_port::live,
@ -1251,7 +1251,7 @@ void lua_engine::initialize()
/* port.field[field_tag] - this should be self explanatory
*/
sol().new_usertype<ioport_field>("ioport_field", "new", sol::no_constructor,
sol().registry().new_usertype<ioport_field>("ioport_field", "new", sol::no_constructor,
"set_value", &ioport_field::set_value,
"device", sol::property(&ioport_field::device),
"name", sol::property(&ioport_field::name),
@ -1281,7 +1281,7 @@ void lua_engine::initialize()
* parameter:lookup(tag) - get val for tag
*/
sol().new_usertype<parameters_manager>("parameters", "new", sol::no_constructor,
sol().registry().new_usertype<parameters_manager>("parameters", "new", sol::no_constructor,
"add", &parameters_manager::add,
"lookup", &parameters_manager::lookup);
@ -1298,7 +1298,7 @@ void lua_engine::initialize()
* video.throttle_rate - throttle rate
*/
sol().new_usertype<video_manager>("video", "new", sol::no_constructor,
sol().registry().new_usertype<video_manager>("video", "new", sol::no_constructor,
"begin_recording", sol::overload([this](video_manager &vm, const char *filename) {
std::string fn = filename;
strreplace(fn, "/", PATH_SEPARATOR);
@ -1328,7 +1328,7 @@ void lua_engine::initialize()
* input:pressed(key) - get pressed state for key
*/
sol().new_usertype<ui_input_manager>("input", "new", sol::no_constructor,
sol().registry().new_usertype<ui_input_manager>("input", "new", sol::no_constructor,
"find_mouse", [](ui_input_manager &ui) {
int32_t x, y;
bool button;
@ -1357,7 +1357,7 @@ void lua_engine::initialize()
* target.zoom - enable zoom
*/
sol().new_usertype<render_target>("target", "new", sol::no_constructor,
sol().registry().new_usertype<render_target>("target", "new", sol::no_constructor,
"view_bounds", [](render_target &rt) {
const render_bounds b = rt.current_view()->bounds();
return std::tuple<float, float, float, float>(b.x0, b.x1, b.y0, b.y1);
@ -1382,7 +1382,7 @@ void lua_engine::initialize()
/* render:ui_container() - this should be self explanatory
*/
sol().new_usertype<render_container>("render_container", "new", sol::no_constructor,
sol().registry().new_usertype<render_container>("render_container", "new", sol::no_constructor,
"orientation", &render_container::orientation,
"xscale", &render_container::xscale,
"yscale", &render_container::yscale,
@ -1397,7 +1397,7 @@ void lua_engine::initialize()
* render.target[] - render_target table
*/
sol().new_usertype<render_manager>("render", "new", sol::no_constructor,
sol().registry().new_usertype<render_manager>("render", "new", sol::no_constructor,
"max_update_rate", &render_manager::max_update_rate,
"ui_target", &render_manager::ui_target,
"ui_container", &render_manager::ui_container,
@ -1427,7 +1427,7 @@ void lua_engine::initialize()
* screen:yscale() - screen y scale factor
*/
sol().new_usertype<screen_device>("screen_dev", "new", sol::no_constructor,
sol().registry().new_usertype<screen_device>("screen_dev", "new", sol::no_constructor,
"draw_box", [](screen_device &sdev, float x1, float y1, float x2, float y2, uint32_t bgcolor, uint32_t fgcolor) {
int sc_width = sdev.visible_area().width();
int sc_height = sdev.visible_area().height();
@ -1548,7 +1548,7 @@ void lua_engine::initialize()
* ui:get_char_width(char) - get width of utf8 glyph char with ui font
*/
sol().new_usertype<mame_ui_manager>("ui", "new", sol::no_constructor,
sol().registry().new_usertype<mame_ui_manager>("ui", "new", sol::no_constructor,
"is_menu_active", &mame_ui_manager::is_menu_active,
"options", [](mame_ui_manager &m) { return static_cast<core_options *>(&m.options()); },
"show_fps", sol::property(&mame_ui_manager::show_fps, &mame_ui_manager::set_show_fps),
@ -1566,7 +1566,7 @@ void lua_engine::initialize()
* state:is_divider() - is state a divider
*/
sol().new_usertype<device_state_entry>("dev_space", "new", sol::no_constructor,
sol().registry().new_usertype<device_state_entry>("dev_space", "new", sol::no_constructor,
"name", &device_state_entry::symbol,
"value", sol::property([this](device_state_entry &entry) -> uint64_t {
device_state_interface *state = entry.parent_state();
@ -1594,7 +1594,7 @@ void lua_engine::initialize()
* memory.shares[] - table of memory shares
*/
sol().new_usertype<memory_manager>("memory", "new", sol::no_constructor,
sol().registry().new_usertype<memory_manager>("memory", "new", sol::no_constructor,
"banks", sol::property([this](memory_manager &mm) {
sol::table table = sol().create_table();
for (auto &bank : mm.banks())
@ -1614,7 +1614,7 @@ void lua_engine::initialize()
return table;
}));
sol().new_usertype<memory_region>("region", "new", sol::no_constructor,
sol().registry().new_usertype<memory_region>("region", "new", sol::no_constructor,
"read_i8", &region_read<int8_t>,
"read_u8", &region_read<uint8_t>,
"read_i16", &region_read<int16_t>,
@ -1633,7 +1633,7 @@ void lua_engine::initialize()
"write_u64", &region_write<uint64_t>,
"size", sol::property(&memory_region::bytes));
sol().new_usertype<memory_share>("share", "new", sol::no_constructor,
sol().registry().new_usertype<memory_share>("share", "new", sol::no_constructor,
"read_i8", &share_read<int8_t>,
"read_u8", &share_read<uint8_t>,
"read_i16", &share_read<int16_t>,
@ -1661,7 +1661,7 @@ void lua_engine::initialize()
* output:id_to_name(index) - get name for index
*/
sol().new_usertype<output_manager>("output", "new", sol::no_constructor,
sol().registry().new_usertype<output_manager>("output", "new", sol::no_constructor,
"set_value", &output_manager::set_value,
"set_indexed_value", &output_manager::set_indexed_value,
"get_value", &output_manager::get_value,
@ -1672,7 +1672,7 @@ void lua_engine::initialize()
/* machine.images[] - images are floppy/cart/cdrom/tape/hdd etc, otherwise this should be self explanatory
*/
sol().new_usertype<device_image_interface>("image", "new", sol::no_constructor,
sol().registry().new_usertype<device_image_interface>("image", "new", sol::no_constructor,
"exists", &device_image_interface::exists,
"filename", &device_image_interface::filename,
"longname", &device_image_interface::longname,
@ -1689,7 +1689,7 @@ void lua_engine::initialize()
"is_creatable", sol::property(&device_image_interface::is_creatable),
"is_reset_on_load", sol::property(&device_image_interface::is_reset_on_load));
sol().new_usertype<mame_machine_manager>("manager", "new", sol::no_constructor,
sol().registry().new_usertype<mame_machine_manager>("manager", "new", sol::no_constructor,
"machine", &machine_manager::machine,
"options", [](mame_machine_manager &m) { return static_cast<core_options *>(&m.options()); },
"plugins", [](mame_machine_manager &m) { return static_cast<core_options *>(&m.plugins()); },