Page 1 of 1

Nil table problem

PostPosted: Tue Jan 01, 2013 21:56
by LorenzoVulcan
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
    local meta = minetest.env:get_meta(pos)
    local inv = meta:get_inventory()
    for i=1,4 do
        local item_stack=inv:get_stack("items", i)
        local item_table=item_stack:to_table()
        if item_table[name] == itemname then


This returns me that item_table is nil and i can't understrand why.

Can anyone help me?

PostPosted: Tue Jan 01, 2013 22:48
by PilzAdam
You may solve the problem by putting
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
print(dump([variable]))
after each defintion of a variable.

PostPosted: Tue Jan 01, 2013 23:30
by kaeza
Can you post the entire error message (only the "LUA ERROR" part).

LorenzoVulcan wrote:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
if item_table[name] == itemname then

I believe this is the line that is causing problems.
It sould be:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
if item_table.name == itemname then