From 85a9c6d050a0d001a325577ef07650f7fb0ecd80 Mon Sep 17 00:00:00 2001 From: Matthew Heguy Date: Mon, 28 Jan 2019 17:48:24 -0500 Subject: [PATCH] Add object_type() to Debug --- utils/debug.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/utils/debug.lua b/utils/debug.lua index f56b1349..35a7d509 100644 --- a/utils/debug.lua +++ b/utils/debug.lua @@ -68,6 +68,16 @@ function Debug.print(message, trace_levels) log(message) end +--- Returns the factorio LuaObject type or the Lua data type +-- @param object +function Debug.object_type(object) + local obj_type = type(object) + if obj_type == 'table' and object.isluaobject then + return match(object.help(),'Lua%a+') + end + return obj_type +end + ---Shows the given message if debug is on. ---@param position Position ---@param message string