From 948482a99e4aae4d51ff97879432140645959f46 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Thu, 2 Feb 2017 21:14:20 +0100 Subject: LuaAutomation: Add interrupt to the ingame API and implement initialization code handling and env management --- advtrains/advtrains_luaautomation/passive.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'advtrains/advtrains_luaautomation/passive.lua') 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 -- cgit v1.2.3