Cool, field:set_value seems to work for buttons.

Code
[MAME]> function printt(a) local i,j; for i,j in pairs(a) do print(i,j) end end
[MAME]> printt(manager:machine():ioport().ports[":joystick_buttons"].fields)
P1 Button 2	sol.ioport_field*: 0x55c6ff3a0d28
P2 Button 1	sol.ioport_field*: 0x55c6ff3a0d68
P1 Button 1	sol.ioport_field*: 0x55c6ff3a0ce8
[MAME]>  print(manager:machine():ioport().ports[":joystick_buttons"]:read())
0
[MAME]> manager:machine():ioport().ports[":joystick_buttons"].fields["P1 Button 2"]:set_value(1)
[MAME]> print(manager:machine():ioport().ports[":joystick_buttons"]:read())
32
[MAME]> manager:machine():ioport().ports[":joystick_buttons"].fields["P1 Button 2"]:set_value(0)
[MAME]>  print(manager:machine():ioport().ports[":joystick_buttons"]:read())
0

I thought I'd try it for a joystick axis value but it doesn't seem to have any effect. I removed the bindings to the second joystick too.

Code
manager:machine():ioport().ports[":joystick_2_y"].fields["P2 Joystick Y"]:set_value(0)
print(manager:machine():ioport().ports[":joystick_2_y"]:read())
128

Last edited by Golden Child; 11/06/17 01:42 AM.