Merge pull request #231 from argonui/trashcan
Trash: adding context menu function to empty
This commit is contained in:
commit
0865c2b92f
@ -34,7 +34,7 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": true,
|
||||
"LuaScript": "",
|
||||
"LuaScript": "require(\"util/Trashcan\")",
|
||||
"LuaScriptState": "",
|
||||
"MaterialIndex": -1,
|
||||
"MeasureMovement": false,
|
||||
|
@ -34,7 +34,7 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": true,
|
||||
"LuaScript": "",
|
||||
"LuaScript": "require(\"util/Trashcan\")",
|
||||
"LuaScriptState": "",
|
||||
"MaterialIndex": -1,
|
||||
"MeasureMovement": false,
|
||||
|
@ -34,7 +34,7 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": true,
|
||||
"LuaScript": "",
|
||||
"LuaScript": "require(\"util/Trashcan\")",
|
||||
"LuaScriptState": "",
|
||||
"MaterialIndex": -1,
|
||||
"MeasureMovement": false,
|
||||
|
@ -34,7 +34,7 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": true,
|
||||
"LuaScript": "",
|
||||
"LuaScript": "require(\"util/Trashcan\")",
|
||||
"LuaScriptState": "",
|
||||
"MaterialIndex": -1,
|
||||
"MeasureMovement": false,
|
||||
|
@ -34,7 +34,7 @@
|
||||
"IgnoreFoW": false,
|
||||
"LayoutGroupSortIndex": 0,
|
||||
"Locked": true,
|
||||
"LuaScript": "",
|
||||
"LuaScript": "require(\"util/Trashcan\")",
|
||||
"LuaScriptState": "",
|
||||
"MaterialIndex": -1,
|
||||
"MeasureMovement": false,
|
||||
|
11
src/util/Trashcan.ttslua
Normal file
11
src/util/Trashcan.ttslua
Normal file
@ -0,0 +1,11 @@
|
||||
-- adds a context menu entry to trigger the emptying
|
||||
function onLoad()
|
||||
self.addContextMenuItem("Empty Trash", emptyTrash)
|
||||
end
|
||||
|
||||
-- removes all objects by taking them out and then destructing them
|
||||
function emptyTrash()
|
||||
for _, trash in ipairs(self.getObjects()) do
|
||||
self.takeObject().destruct()
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user