.wp/.tw_exch added - exchange top two entries
parent
0d0fb9a49a
commit
647bef69ef
31
init.lua
31
init.lua
|
@ -12,7 +12,7 @@ end
|
|||
|
||||
log('action', 'CSM cs_waypoints '..mod_version..' loading...')
|
||||
|
||||
minetest.display_chat_message("CSM cs_waypoints loading...")
|
||||
minetest.display_chat_message("CSM cs_waypoints '..mod_version..' loading...")
|
||||
|
||||
local mod_storage = minetest.get_mod_storage()
|
||||
|
||||
|
@ -156,6 +156,22 @@ local function stack_use()
|
|||
return true
|
||||
end
|
||||
|
||||
local function stack_exch()
|
||||
wp_stack = load_waypoints_stack()
|
||||
count = 0
|
||||
if nil ~= wp_stack then count = #wp_stack end
|
||||
if count<2 then
|
||||
minetest.display_chat_message('less than 2 entries - no change')
|
||||
return
|
||||
end
|
||||
local exch = wp_stack[count]
|
||||
wp_stack[count] = wp_stack[count-1]
|
||||
wp_stack[count-1] = exch
|
||||
mod_storage:set_string('waypoints_stack', minetest.serialize(wp_stack))
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
local function stack_show()
|
||||
wp_stack = load_waypoints_stack()
|
||||
count = 0
|
||||
|
@ -407,6 +423,19 @@ minetest.register_chatcommand('wp_use', {
|
|||
}
|
||||
)
|
||||
|
||||
minetest.register_chatcommand('tw_exch', {
|
||||
params = '',
|
||||
description = 'exchange the top two stack entried',
|
||||
func = stack_exch,
|
||||
}
|
||||
)
|
||||
|
||||
minetest.register_chatcommand('wp_exch', {
|
||||
params = '',
|
||||
description = 'exchange the top two stack entried',
|
||||
func = stack_exch,
|
||||
}
|
||||
)
|
||||
minetest.register_chatcommand('wp_stack', {
|
||||
params = '',
|
||||
description = 'shows the stack content',
|
||||
|
|
Loading…
Reference in New Issue