summaryrefslogtreecommitdiffstatshomepage
path: root/src/frontend
diff options
context:
space:
mode:
authorGravatarGravatar npwoods <npwoods@mess.org>2019-08-23 20:01:49 -0400
committerGravatarGravatar npwoods <npwoods@mess.org>2019-08-23 20:01:49 -0400
commit225ef45b7d98c72c4ff34b80320bc26e7116d797 (patch)
treeb053c62869a2b6daf636a9cdd973b9daefc24d9b /src/frontend
parent70f176f74f42366ffc69fc048085edce7ffd8ce1 (diff)
Exposing ioport_manager::type_group() and ioport_field::keyboard_codes()
to LUA
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/mame/luaengine.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp
index 688dca7aa44..df730b7019f 100644
--- a/src/frontend/mame/luaengine.cpp
+++ b/src/frontend/mame/luaengine.cpp
@@ -1709,6 +1709,7 @@ void lua_engine::initialize()
* manager:machine():ioport()
*
* ioport:count_players() - get count of player controllers
+ * ioport:type_group(type, player)
*
* ioport.ports[] - ioports table (k=tag, v=ioport_port)
*/
@@ -1716,6 +1717,9 @@ void lua_engine::initialize()
sol().registry().new_usertype<ioport_manager>("ioport", "new", sol::no_constructor,
"count_players", &ioport_manager::count_players,
"natkeyboard", &ioport_manager::natkeyboard,
+ "type_group", [](ioport_manager &im, ioport_type type, int player) {
+ return im.type_group(type, player);
+ },
"ports", sol::property([this](ioport_manager &im) {
sol::table port_table = sol().create_table();
for (auto &port : im.ports())
@@ -1795,6 +1799,7 @@ void lua_engine::initialize()
* field:input_seq(seq_type)
* field:set_default_input_seq(seq_type, seq)
* field:default_input_seq(seq_type)
+ * field:keyboard_codes(which)
*
* field.device - get associated device_t
* field.port - get associated ioport_port
@@ -1846,6 +1851,14 @@ void lua_engine::initialize()
input_seq_type seq_type = parse_seq_type(seq_type_string);
return sol::make_user(f.defseq(seq_type));
},
+ "keyboard_codes", [this](ioport_field &f, int which)
+ {
+ sol::table result = sol().create_table();
+ int index = 1;
+ for (char32_t code : f.keyboard_codes(which))
+ result[index++] = code;
+ return result;
+ },
"device", sol::property(&ioport_field::device),
"port", sol::property(&ioport_field::port),
"name", sol::property(&ioport_field::name),