luaengine: use screen_device_iterator rather than first_screen (nw)

This commit is contained in:
cracyc 2018-03-03 14:46:12 -06:00
parent 3fd745c2a7
commit 5a018f17f3

View File

@ -1181,11 +1181,10 @@ void lua_engine::initialize()
}), }),
"screens", sol::property([this](running_machine &r) { "screens", sol::property([this](running_machine &r) {
sol::table table = sol().create_table(); sol::table table = sol().create_table();
for(device_t *dev = r.first_screen(); dev != nullptr; dev = dev->next()) for (screen_device &sc : screen_device_iterator(r.root_device()))
{ {
screen_device *sc = dynamic_cast<screen_device *>(dev); if (sc.configured() && sc.started() && sc.type())
if (sc && sc->configured() && sc->started() && sc->type()) table[sc.tag()] = &sc;
table[sc->tag()] = sc;
} }
return table; return table;
}), }),