aboutsummaryrefslogtreecommitdiff
path: root/advtrains/advtrains_luaautomation/passive.lua
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2017-02-02 21:14:20 +0100
committerorwell96 <mono96.mml@gmail.com>2017-02-02 21:14:20 +0100
commit948482a99e4aae4d51ff97879432140645959f46 (patch)
tree7920fcec8ee918e56e3c67acbf1b7ce4335bc740 /advtrains/advtrains_luaautomation/passive.lua
parentb19033b224f4f8ec33f10ba40327f1d811c04fbb (diff)
downloadadvtrains-948482a99e4aae4d51ff97879432140645959f46.tar.gz
advtrains-948482a99e4aae4d51ff97879432140645959f46.tar.bz2
advtrains-948482a99e4aae4d51ff97879432140645959f46.zip
LuaAutomation: Add interrupt to the ingame API and implement initialization code handling and env management
Diffstat (limited to 'advtrains/advtrains_luaautomation/passive.lua')
-rw-r--r--advtrains/advtrains_luaautomation/passive.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/advtrains/advtrains_luaautomation/passive.lua b/advtrains/advtrains_luaautomation/passive.lua
index 78b8c2d..e32bee9 100644
--- a/advtrains/advtrains_luaautomation/passive.lua
+++ b/advtrains/advtrains_luaautomation/passive.lua
@@ -2,6 +2,10 @@
-- API to passive components, as described in passive_api.txt
local function getstate(pos)
+ if not type(pos)=="table" or not pos.x or not pos.y or not pos.z then
+ debug.sethook()
+ error("Invalid position supplied to getstate")
+ end
local node=advtrains.ndb.get_node(pos)
local ndef=minetest.registered_nodes[node.name]
if ndef and ndef.luaautomation and ndef.luaautomation.getstate then
@@ -16,6 +20,10 @@ local function getstate(pos)
end
local function setstate(pos, newstate)
+ if not type(pos)=="table" or not pos.x or not pos.y or not pos.z then
+ debug.sethook()
+ error("Invalid position supplied to setstate")
+ end
local node=advtrains.ndb.get_node(pos)
local ndef=minetest.registered_nodes[node.name]
if ndef and ndef.luaautomation and ndef.luaautomation.setstate then