I just figured out how to directly access members in luaengine, just specify them directly, what could be easier?

It's shocking how easy that is...

and if you want it read only just make it a property.

device_luaprinter_interface_type.set("xposprop", sol::property(&device_luaprinter_interface::m_lp_xpos));
device_luaprinter_interface_type.set("name", &device_luaprinter_interface::m_lp_luaprintername);
device_luaprinter_interface_type.set("xpos", &device_luaprinter_interface::m_lp_xpos);

So then you can modify the variables directly, like manager:machine().lp[1].xpos = 200

[MAME] function listlp()
[MAME]>>   print("listlp()  list of luaprinters:")
[MAME]>>   print("------------------------------")
[MAME]>>   for i,j in pairs(manager:machine().lp) do
[MAME]>>     print("lp["..i.."] = "..j:getprintername())
[MAME]>>   end
[MAME]>>   print("------------------------------")
[MAME]>> end
[MAME]> listlp()
listlp()  list of luaprinters:
lp[1] = 2020-10-12 10-36-18 apple2e-sl1-parallel-pic_ctx-luaprinter
lp[:sl1:parallel:pic_ctx:luaprinter] = 2020-10-12 10-36-18 apple2e-sl1-parallel-pic_ctx-luaprinter
[MAME]> print(manager:machine().lp[1].name)
2020-10-12 10-36-18 apple2e-sl1-parallel-pic_ctx-luaprinter
[MAME]> manager:machine().lp[1].name = "hi_there"
[MAME]> print(manager:machine().lp[1].name)

And I was also experimenting with being able to execute lua code from inside the ap2000 driver, so I could call a lua function to say, generate dots for a pdf. So how to execute lua code? Just call load_string.

device_luaprinter_interface_type.set("loadstring", [this](char const *astr)
     { printf("Trying %s\n",astr); return lua_engine::load_string(astr);  });

[MAME]> manager:machine().lp[1].loadstring('print("IT WORKS")')
Trying print("IT WORKS")
[MAME]> function dude(x) print ("This is a function that prints "..x) end
[MAME]> manager:machine().lp[1].loadstring('dude("IT WORKS")')
Trying dude("IT WORKS")
This is a function that prints IT WORKS

So now I need to figure out how to make it possible to call the luaengine from inside the driver.

It'd also be cool if you could load_string a string from the debugger, so you could do something complex in lua, so do something similar to a printf but make it lua code to execute.