summaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_item.cpp
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2017-10-07 15:11:07 +0200
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-10-07 15:11:07 +0200
commitf547452685b299712ff5aa15bf06b4cd6069deec (patch)
tree67ecd50b6c1b7bcfaee33349a20133e0bc09d637 /src/script/cpp_api/s_item.cpp
parent00ceec9ff939fa9cf82a93e4b43a345d86f765a5 (diff)
downloadminetest-f547452685b299712ff5aa15bf06b4cd6069deec.tar.gz
minetest-f547452685b299712ff5aa15bf06b4cd6069deec.tar.bz2
minetest-f547452685b299712ff5aa15bf06b4cd6069deec.zip
Unkown nodes: Provide position on interact (#6505)
* Unkown nodes: Provide position on interact
Diffstat (limited to 'src/script/cpp_api/s_item.cpp')
-rw-r--r--src/script/cpp_api/s_item.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/script/cpp_api/s_item.cpp b/src/script/cpp_api/s_item.cpp
index 3876272d7..5d9d26083 100644
--- a/src/script/cpp_api/s_item.cpp
+++ b/src/script/cpp_api/s_item.cpp
@@ -211,7 +211,8 @@ bool ScriptApiItem::item_CraftPredict(ItemStack &item, ServerActiveObject *user,
// function onto the stack
// If core.registered_items[name] doesn't exist, core.nodedef_default
// is tried instead so unknown items can still be manipulated to some degree
-bool ScriptApiItem::getItemCallback(const char *name, const char *callbackname)
+bool ScriptApiItem::getItemCallback(const char *name, const char *callbackname,
+ const v3s16 *p)
{
lua_State* L = getStack();
@@ -222,10 +223,12 @@ bool ScriptApiItem::getItemCallback(const char *name, const char *callbackname)
lua_getfield(L, -1, name);
lua_remove(L, -2); // Remove registered_items
// Should be a table
- if(lua_type(L, -1) != LUA_TTABLE)
- {
+ if (lua_type(L, -1) != LUA_TTABLE) {
// Report error and clean up
- errorstream << "Item \"" << name << "\" not defined" << std::endl;
+ errorstream << "Item \"" << name << "\" not defined";
+ if (p)
+ errorstream << " at position " << PP(*p);
+ errorstream << std::endl;
lua_pop(L, 1);
// Try core.nodedef_default instead