On lua script (plugin MAME), i try to understand the logic. I create a simple plugin to write a file with “test”. (no wiki )
Code: Select all
-- test.lua
-- by XXXX
--
--
local exports = {}
exports.name = "test"
exports.version = "1.0.0"
exports.description = "Test"
exports.license = "NewQuest"
exports.author = { name = "XXXX" }
local test = exports
function test.startplugin()
local test_path = "test";
local function get_file_name ()
local r;
if emu.softname() ~= "" then
r = test_path .. '/' .. emu.romname() .. "_" .. emu.softname() .. ".txt";
else
r = test_path .. '/' .. emu.romname() .. ".txt";
end
return r;
end
emu.print_verbose("test: init")
emu.print_verbose(get_file_name())
local output = io.open(get_file_name(), "wb");
if not output then
-- attempt to create the directory, and try again
lfs.mkdir( test_path );
output = io.open(get_file_name(), "wb");
end
output:write("test");
output:close();
end
return exports
Where is display “emu.print_verbose” ?
On plugin.json, option “start” : true/false What's the point?
If i set start:true on my test plugin, MAME can not play games
If i set start:false on my test plugin : it’s ok but a file don’t created
And if start:false when plugin is executed ?
Thanks for you help