@@ -45,8 +45,8 @@ int ScriptApiNodemeta::nodemeta_inventory_AllowMove(v3s16 p,
45
45
return 0 ;
46
46
47
47
// Push callback function on stack
48
- if (! getItemCallback ( ndef->get (node).name . c_str (),
49
- " allow_metadata_inventory_move" ))
48
+ std::string nodename = ndef->get (node).name ;
49
+ if (! getItemCallback (nodename. c_str (), " allow_metadata_inventory_move" ))
50
50
return count;
51
51
52
52
// function(pos, from_list, from_index, to_list, to_index, count, player)
@@ -61,7 +61,8 @@ int ScriptApiNodemeta::nodemeta_inventory_AllowMove(v3s16 p,
61
61
scriptError ();
62
62
lua_remove (L, errorhandler); // Remove error handler
63
63
if (!lua_isnumber (L, -1 ))
64
- throw LuaError (NULL , " allow_metadata_inventory_move should return a number" );
64
+ throw LuaError (NULL , " allow_metadata_inventory_move should"
65
+ " return a number, guilty node: " + nodename);
65
66
int num = luaL_checkinteger (L, -1 );
66
67
lua_pop (L, 1 ); // Pop integer
67
68
return num;
@@ -85,8 +86,8 @@ int ScriptApiNodemeta::nodemeta_inventory_AllowPut(v3s16 p,
85
86
return 0 ;
86
87
87
88
// Push callback function on stack
88
- if (! getItemCallback ( ndef->get (node).name . c_str (),
89
- " allow_metadata_inventory_put" ))
89
+ std::string nodename = ndef->get (node).name ;
90
+ if (! getItemCallback (nodename. c_str (), " allow_metadata_inventory_put" ))
90
91
return stack.count ;
91
92
92
93
// Call function(pos, listname, index, stack, player)
@@ -99,7 +100,8 @@ int ScriptApiNodemeta::nodemeta_inventory_AllowPut(v3s16 p,
99
100
scriptError ();
100
101
lua_remove (L, errorhandler); // Remove error handler
101
102
if (!lua_isnumber (L, -1 ))
102
- throw LuaError (NULL , " allow_metadata_inventory_put should return a number" );
103
+ throw LuaError (NULL , " allow_metadata_inventory_put should"
104
+ " return a number, guilty node: " + nodename);
103
105
int num = luaL_checkinteger (L, -1 );
104
106
lua_pop (L, 1 ); // Pop integer
105
107
return num;
@@ -123,8 +125,8 @@ int ScriptApiNodemeta::nodemeta_inventory_AllowTake(v3s16 p,
123
125
return 0 ;
124
126
125
127
// Push callback function on stack
126
- if (! getItemCallback ( ndef->get (node).name . c_str (),
127
- " allow_metadata_inventory_take" ))
128
+ std::string nodename = ndef->get (node).name ;
129
+ if (! getItemCallback (nodename. c_str (), " allow_metadata_inventory_take" ))
128
130
return stack.count ;
129
131
130
132
// Call function(pos, listname, index, count, player)
@@ -137,7 +139,8 @@ int ScriptApiNodemeta::nodemeta_inventory_AllowTake(v3s16 p,
137
139
scriptError ();
138
140
lua_remove (L, errorhandler); // Remove error handler
139
141
if (!lua_isnumber (L, -1 ))
140
- throw LuaError (NULL , " allow_metadata_inventory_take should return a number" );
142
+ throw LuaError (NULL , " allow_metadata_inventory_take should"
143
+ " return a number, guilty node: " + nodename);
141
144
int num = luaL_checkinteger (L, -1 );
142
145
lua_pop (L, 1 ); // Pop integer
143
146
return num;
@@ -162,8 +165,8 @@ void ScriptApiNodemeta::nodemeta_inventory_OnMove(v3s16 p,
162
165
return ;
163
166
164
167
// Push callback function on stack
165
- if (! getItemCallback ( ndef->get (node).name . c_str (),
166
- " on_metadata_inventory_move" ))
168
+ std::string nodename = ndef->get (node).name ;
169
+ if (! getItemCallback (nodename. c_str (), " on_metadata_inventory_move" ))
167
170
return ;
168
171
169
172
// function(pos, from_list, from_index, to_list, to_index, count, player)
@@ -197,8 +200,8 @@ void ScriptApiNodemeta::nodemeta_inventory_OnPut(v3s16 p,
197
200
return ;
198
201
199
202
// Push callback function on stack
200
- if (! getItemCallback ( ndef->get (node).name . c_str (),
201
- " on_metadata_inventory_put" ))
203
+ std::string nodename = ndef->get (node).name ;
204
+ if (! getItemCallback (nodename. c_str (), " on_metadata_inventory_put" ))
202
205
return ;
203
206
204
207
// Call function(pos, listname, index, stack, player)
@@ -230,8 +233,8 @@ void ScriptApiNodemeta::nodemeta_inventory_OnTake(v3s16 p,
230
233
return ;
231
234
232
235
// Push callback function on stack
233
- if (! getItemCallback ( ndef->get (node).name . c_str (),
234
- " on_metadata_inventory_take" ))
236
+ std::string nodename = ndef->get (node).name ;
237
+ if (! getItemCallback (nodename. c_str (), " on_metadata_inventory_take" ))
235
238
return ;
236
239
237
240
// Call function(pos, listname, index, stack, player)
0 commit comments