So if I add to my list of printers in the constructor, I get a whole bunch of devices in my list.

It seems to be initializing a bunch of devices that don't actually get used. It must be enumerating every possible device that uses the luaprinter.

Code
luaprinter::luaprinter(device_t& thisdevice, int testvalue){ 
	m_lp_mydevice = &thisdevice; 
	time(&m_lp_session_time);  
	initvalue = testvalue;

	addtoprinterlist( *this);
	printf("yes you can");
	printf(" device = %s ",thisdevice.tag());
	fflush(stdout);
	printf("count = %d\n",count());  // the size of the printerlist
	fflush(stdout);
	
	};

with one luaprinter device I get 19 items:

Code
./mame64 ct486   -hard1 hd128MB  -debug  -board4:lpt:lpt:centronics luaprinter -confirm_quit -ramsize 64M 
-board3:ide:ide:1 hdd -hard2 hd128MBpt -board3:ide:ide:1 hdd
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 1
...
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 9
    _/      _/    _/_/    _/      _/  _/_/_/_/
   _/_/  _/_/  _/    _/  _/_/  _/_/  _/       
  _/  _/  _/  _/_/_/_/  _/  _/  _/  _/_/_/    
 _/      _/  _/    _/  _/      _/  _/         
_/      _/  _/    _/  _/      _/  _/_/_/_/    

mame 0.224	
Copyright (C) Nicola Salmoria and the MAME team

Lua 5.3	
Copyright (C) Lua.org, PUC-Rio

yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 10
yes you can device = :board2:comat:serport0:luaprinter count = 11
yes you can device = :board2:comat:serport1:luaprinter count = 12
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 13
yes you can device = :board4:lpt:lpt:centronics:ap2000 count = 14
yes you can device = :board4:lpt:lpt:centronics:lx810l count = 15
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 16
Debug Build: Disabling input grab for -debug
Debug Build: Disabling input grab for -debug
Debug Build: Disabling input grab for -debug
[MAME]> 
"hd128MB" approximately matches the following
supported software items (best match first):


"hd128MBpt" approximately matches the following
supported software items (best match first):

DEVICE START CALL luaprinterlist

DEVICE START CALL luaprinterlist

DEVICE START CALL setprintername

DEVICE RESET CALLED
DEVICE RESET CALLED


MAME debugger version 0.224 (mame0224-205-g69406ddcc71-dirty)
Currently targeting ct486 (PC/AT 486 with CS4031 chipset)
[MAME]> yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 18
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 19

and if I add a second luaprinter device I get 35 total devices.


Code
/mame64 ct486  -hard1 hd128MB  -debug  -board4:lpt:lpt:centronics luaprinter -confirm_quit -ramsize 64M
 -board3:ide:ide:1 hdd -hard2 hd128MBpt -board3:ide:ide:1 hdd -board2:comat:serport1 luaprinter
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 1
...
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 8
yes you can device = :board2:comat:serport1:luaprinter count = 9
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 10
yes you can device = :board2:comat:serport1:luaprinter count = 11
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 12
yes you can device = :board2:comat:serport1:luaprinter count = 13
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 14
yes you can device = :board2:comat:serport1:luaprinter count = 15
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 16
yes you can device = :board2:comat:serport1:luaprinter count = 17
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 18
yes you can device = :board2:comat:serport1:luaprinter count = 19
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 20
    _/      _/    _/_/    _/      _/  _/_/_/_/
   _/_/  _/_/  _/    _/  _/_/  _/_/  _/       
  _/  _/  _/  _/_/_/_/  _/  _/  _/  _/_/_/    
 _/      _/  _/    _/  _/      _/  _/         
_/      _/  _/    _/  _/      _/  _/_/_/_/    

mame 0.224	
Copyright (C) Nicola Salmoria and the MAME team

Lua 5.3	
Copyright (C) Lua.org, PUC-Rio

yes you can device = :board2:comat:serport1:luaprinter count = 21
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 22
yes you can device = :board2:comat:serport0:luaprinter count = 23
yes you can device = :board2:comat:serport1:luaprinter count = 24
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 25
yes you can device = :board4:lpt:lpt:centronics:ap2000 count = 26
yes you can device = :board4:lpt:lpt:centronics:lx810l count = 27
yes you can device = :board2:comat:serport1:luaprinter count = 28
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 29
Debug Build: Disabling input grab for -debug
Debug Build: Disabling input grab for -debug
Debug Build: Disabling input grab for -debug
[MAME]> 
"hd128MB" approximately matches the following
supported software items (best match first):


"hd128MBpt" approximately matches the following
supported software items (best match first):

DEVICE START CALL luaprinterlist

DEVICE START CALL luaprinterlist

DEVICE START CALL setprintername

DEVICE RESET CALLED
DEVICE RESET CALLED
m_rs232_rxbaud read=7
rs232_rxbaud read=7


MAME debugger version 0.224 (mame0224-205-g69406ddcc71-dirty)
Currently targeting ct486 (PC/AT 486 with CS4031 chipset)
[MAME]> 

>g
[MAME]> yes you can device = :board2:comat:serport1:luaprinter count = 32
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 33
yes you can device = :board2:comat:serport1:luaprinter count = 34
yes you can device = :board4:lpt:lpt:centronics:luaprinter count = 35
Average speed: 99.93% (1 seconds)

Well, I guess as long as it works I'll keep it outside the constructor.