Horrible hack part #3:

I wanted to see if I could create a function under the emu table that would give me all of the items:

// New function emu["items"]

	emu["items"] = [this](){ 	sol::table table = sol().create_table();
					// 10000 is enough?
					for(int i = 0; i < 10000; i++)
						std::string name;
						const char *item;
						unsigned int size, count;
						void *base;
						item = machine().save().indexed_item(i, base, size, count);
						if(!item) break;
						//name = &(strchr(item, '/')[1]);
						name = item;
						table[name] = i;
					return table;

Now I can do this:

print(emu.item(emu.items()["Apple //e/:/0/m_y_calibration"]):readasdouble(0))

If I uncomment the //name = &(strchr(item, '/')[1]); it will strip off the leading part up to the first / but I kind of like having the full name. It also matches the names that show up in the Debug: Memory View.

function printt(a) for i,j in pairs(a) do print(i,j) end end
function printto(a) local b={} for i,j in pairs(a) do b[j]=i end printt(b) end

[MAME]> printto(emu.items())
1 5.25" single density floppy drive/:sl6:diskiing:0:525/0/m_clock
2 5.25" single density floppy drive/:sl6:diskiing:0:525/0/m_clock_scale
142 Apple //e/:/0/m_x_calibration
143 Apple //e/:/0/m_xirq
144 Apple //e/:/0/m_xy
145 Apple //e/:/0/m_y0
146 Apple //e/:/0/m_y0edge
147 Apple //e/:/0/m_y1
148 Apple //e/:/0/m_y_calibration
149 Apple //e/:/0/m_yirq
828 timer/sound_manager::update/0/m_start.attoseconds
829 timer/sound_manager::update/0/m_start.seconds