Nil table problem

User avatar
LorenzoVulcan
Member
 
Posts: 437
Joined: Mon Mar 12, 2012 06:46

Nil table problem

by LorenzoVulcan » Tue Jan 01, 2013 21:56

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?
Developer of the BlockForge 2# Project!
Official thread: http://minetest.net/forum/viewtopic.php?pid=54290#p54290
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Tue Jan 01, 2013 22:48

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.
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

by kaeza » Tue Jan 01, 2013 23:30

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
Last edited by kaeza on Tue Jan 01, 2013 23:30, edited 1 time in total.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 4 guests

cron