|
LUA Script Help (trying to insert a coin)
#394820 - 09/24/22 09:04 PM
|
|
|
|
|
Re: LUA Script Help (trying to insert a coin)
[Re: Yugffuts]
#394822 - 09/25/22 12:17 AM
|
|
|
There are two included plugins that manipulate inputs:
See if you can work something out.
|
|
|
|
Re: LUA Script Help (trying to insert a coin)
[Re: Vas Crabb]
#395162 - 11/18/22 01:53 AM
|
|
|
All right, I found "function lib:load_settings()" in autofire_save.lua which appears to be what I was looking for (identifying the machine buttons), so thanks for that!
Unfortunately, I'm seeing errors when attempting to require JSON from the console.
Code:
D:\MAME>mame64_247 mk -window -console -sound none
mame 0.247 Copyright (C) Nicola Salmoria and the MAME team
Lua 5.3 Copyright (C) Lua.org, PUC-Rio
[MAME]> local json = require('json') [MAME]> print(json.stringify("{'test': 555}")) error: [string "..."]:2: attempt to index a nil value (global 'json') [MAME]>
Am I doing something wrong? Does "require" not work from the command line?
|
|
|
|
Re: LUA Script Help (trying to insert a coin)
[Re: Yugffuts]
#395165 - 11/18/22 07:23 AM
|
|
|
Each line you type on the console is effectively run as a function. This means that any local variables will only persist until the end of that line. The json variable you created no longer existed when you tried using it.
|
|
|
|
Re: LUA Script Help (trying to insert a coin)
[Re: Vas Crabb]
#395169 - 11/18/22 04:19 PM
|
|
|
Thank you Vas!!
It seems I had a few issues there, overlooking "local" and also my JSON test was not the right syntax
This works as intended.
Code:
json=require('json') print(json.stringify("{'test':'555'}"))
|
|
|