aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/common/strict.lua14
-rw-r--r--builtin/fstk/ui.lua6
-rw-r--r--builtin/game/deprecated.lua13
-rw-r--r--builtin/game/register.lua2
-rw-r--r--builtin/init.lua2
5 files changed, 16 insertions, 21 deletions
diff --git a/builtin/common/strict.lua b/builtin/common/strict.lua
index c7b86461f..05ceadf7a 100644
--- a/builtin/common/strict.lua
+++ b/builtin/common/strict.lua
@@ -9,11 +9,6 @@ function core.global_exists(name)
end
-local function warn(message)
- print(os.date("%H:%M:%S: WARNING: ")..message)
-end
-
-
local meta = {}
local declared = {}
-- Key is source file, line, and variable name; seperated by NULs
@@ -27,7 +22,7 @@ function meta:__newindex(name, value)
info.currentline, name)
if not warned[warn_key] and info.what ~= "main" and
info.what ~= "C" then
- warn(("Assignment to undeclared "..
+ core.log("warning", ("Assignment to undeclared "..
"global %q inside a function at %s.")
:format(name, desc))
warned[warn_key] = true
@@ -35,9 +30,8 @@ function meta:__newindex(name, value)
declared[name] = true
end
-- Ignore mod namespaces
- if WARN_INIT and (not core.get_current_modname or
- name ~= core.get_current_modname()) then
- warn(("Global variable %q created at %s.")
+ if WARN_INIT and name ~= core.get_current_modname() then
+ core.log("warning", ("Global variable %q created at %s.")
:format(name, desc))
end
rawset(self, name, value)
@@ -48,7 +42,7 @@ function meta:__index(name)
local info = debug.getinfo(2, "Sl")
local warn_key = ("%s\0%d\0%s"):format(info.source, info.currentline, name)
if not declared[name] and not warned[warn_key] and info.what ~= "C" then
- warn(("Undeclared global variable %q accessed at %s:%s")
+ core.log("warning", ("Undeclared global variable %q accessed at %s:%s")
:format(name, info.short_src, info.currentline))
warned[warn_key] = true
end
diff --git a/builtin/fstk/ui.lua b/builtin/fstk/ui.lua
index 8128c5035..3ac0386ca 100644
--- a/builtin/fstk/ui.lua
+++ b/builtin/fstk/ui.lua
@@ -127,11 +127,13 @@ function ui.update()
end
if (active_toplevel_ui_elements > 1) then
- print("WARNING: ui manager detected more then one active ui element, self most likely isn't intended")
+ core.log("warning", "more than one active ui "..
+ "element, self most likely isn't intended")
end
if (active_toplevel_ui_elements == 0) then
- print("WARNING: not a single toplevel ui element active switching to default")
+ core.log("warning", "no toplevel ui element "..
+ "active; switching to default")
ui.childlist[ui.default]:show()
formspec = ui.childlist[ui.default]:get_formspec()
end
diff --git a/builtin/game/deprecated.lua b/builtin/game/deprecated.lua
index 405e599da..cd1cf5e2d 100644
--- a/builtin/game/deprecated.lua
+++ b/builtin/game/deprecated.lua
@@ -4,8 +4,7 @@
-- Default material types
--
local function digprop_err()
- core.log("info", debug.traceback())
- core.log("info", "WARNING: The core.digprop_* functions are obsolete and need to be replaced by item groups.")
+ core.log("deprecated", "The core.digprop_* functions are obsolete and need to be replaced by item groups.")
end
core.digprop_constanttime = digprop_err
@@ -16,12 +15,12 @@ core.digprop_woodlike = digprop_err
core.digprop_leaveslike = digprop_err
core.digprop_glasslike = digprop_err
-core.node_metadata_inventory_move_allow_all = function()
- core.log("info", "WARNING: core.node_metadata_inventory_move_allow_all is obsolete and does nothing.")
+function core.node_metadata_inventory_move_allow_all()
+ core.log("deprecated", "core.node_metadata_inventory_move_allow_all is obsolete and does nothing.")
end
-core.add_to_creative_inventory = function(itemstring)
- core.log('info', "WARNING: core.add_to_creative_inventory: This function is deprecated and does nothing.")
+function core.add_to_creative_inventory(itemstring)
+ core.log("deprecated", "core.add_to_creative_inventory: This function is deprecated and does nothing.")
end
--
@@ -32,7 +31,7 @@ local envref_deprecation_message_printed = false
setmetatable(core.env, {
__index = function(table, key)
if not envref_deprecation_message_printed then
- core.log("info", "WARNING: core.env:[...] is deprecated and should be replaced with core.[...]")
+ core.log("deprecated", "core.env:[...] is deprecated and should be replaced with core.[...]")
envref_deprecation_message_printed = true
end
local func = core[key]
diff --git a/builtin/game/register.lua b/builtin/game/register.lua
index d0e04bfc3..840ade127 100644
--- a/builtin/game/register.lua
+++ b/builtin/game/register.lua
@@ -221,7 +221,7 @@ function core.register_alias(name, convert_to)
error("Unable to register alias: Name is forbidden: " .. name)
end
if core.registered_items[name] ~= nil then
- core.log("WARNING: Not registering alias, item with same name" ..
+ core.log("warning", "Not registering alias, item with same name" ..
" is already defined: " .. name .. " -> " .. convert_to)
else
--core.log("Registering alias: " .. name .. " -> " .. convert_to)
diff --git a/builtin/init.lua b/builtin/init.lua
index 095771d19..02fb9db93 100644
--- a/builtin/init.lua
+++ b/builtin/init.lua
@@ -6,7 +6,7 @@
--
-- Initialize some very basic things
-print = core.debug
+function core.debug(...) core.log(table.concat({...}, "\t")) end
math.randomseed(os.time())
os.setlocale("C", "numeric")
minetest = core