Add files via upload

master
zmv7 2022-03-20 16:50:48 +05:00 committed by GitHub
commit 531e309d99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 0 deletions

28
init.lua Normal file
View File

@ -0,0 +1,28 @@
local storage = minetest.get_mod_storage()
if not storage:get_string('luahist') then storage:set_string('luahist','') end
function genlist()
local fspec =
"size[16,9]"..
"field[0.2,0.3;16,1;code;Code:;]"..
"field_close_on_enter[code;false]"..
"button[14.5,1;1.4,1;run;Run!]"..
"textarea[0.2,2;16,8.5;hist;Notes & History:;"..storage:get_string('luahist').."]"..
"button[12.5,1;2,1;save;Save notes]"
return fspec
end
minetest.register_chatcommand("lua", {
description = "Open luagui",
func = function(param)
core.show_formspec('luagui',genlist())
end})
core.register_on_formspec_input(function(formname, fields)
if formname == "luagui" then
if fields.run then
core.run_server_chatcommand('/lua',fields.code)
storage:set_string('luahist',storage:get_string('luahist')..core.formspec_escape(fields.code)..'\n')
core.show_formspec('luagui',genlist())
elseif fields.save then
storage:set_string('luahist',fields.hist)
end
end
end)

1
mod.conf Normal file
View File

@ -0,0 +1 @@
name = luagui