local function

master
zmv7 2022-03-20 22:27:12 +05:00 committed by GitHub
parent 27335f6229
commit ada32ef6ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
local storage = minetest.get_mod_storage()
if not storage:get_string('luahist') then storage:set_string('luahist','') end
function genlist()
local function genfs()
local fspec =
"size[16,9]"..
"field[0.2,0.3;16,1;code;Code:;]"..
@ -13,14 +13,14 @@ end
minetest.register_chatcommand("lua", {
description = "Open luagui",
func = function(param)
core.show_formspec('luagui',genlist())
core.show_formspec('luagui',genfs())
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())
core.show_formspec('luagui',genfs())
elseif fields.save then
storage:set_string('luahist',fields.hist)
end