Jump to content

[PyLUA++]Tradehouse / LUA_ERROR


Recommended Posts

  • Premium

Hi Metin2Dev,

 

I need help with this:

20:20:57.867740 :: RunState: LUA_ERROR: locale/hungary/quest/object/state/mb_igshop:984: attempt to call field `give_item_with' (a nil value)
SYSERR: Oct 30 20:20:57.867829 :: WriteRunningStateToSyserr: LUA_ERROR: quest mb_igshop.start click

 

 

This happens when someone buys the product I am offering for sale and wants to take it out or when I just want to smoothly withdraw a sale.

 

Please help me! Thanks! Have a nice day!

Link to comment
Share on other sites

  • Developer

I can't tell you how to solve it, i can just try to explain you what's happen here:
 

LUA_ERROR: locale/hungary/quest/object/state/mb_igshop:984: attempt to call field `give_item_with' (a nil value)

 

The Error is saying us that a quest is calling give_item_with (i guess you might find it as pc.give_item_with) which is not defined in the module (it might be pc module) and the attempt to call it returned a nil value (because can't find its function body defined). 
The way to solve it is to define the body of the function.

Usually the lua modules are defined by passing a function table e.g. here we have:

 

void RegisterPCFunctionTable()
{
  luaL_reg pc_functions[] =
    {
    { "get_wear",		pc_get_wear			},
    { "get_player_id",	pc_get_player_id	},
    { "get_account_id", pc_get_account_id	},
    { "get_account",	pc_get_account		},
    //[........]
    //[........]
    //[........]			
    { NULL,			NULL			}
  };

  CQuestManager::instance().AddLuaFunctionTable("pc", pc_functions);
}

 

As you can see here we have a list of methods defined by giving them a name (callable from lua) and a definition which is defined in the .cpp file (e.g. questlua_pc.cpp)

 

Conclusion is that you need to define your function which is giving you that error and to add it to the appropriate function table.

Edited by Ikarus_
  • Love 1

My youtube channel  on which you can see my works here

Link to comment
Share on other sites

  • Premium
14 hours ago, Ikarus_ said:

I can't tell you how to solve it, i can just try to explain you what's happen here:
 


LUA_ERROR: locale/hungary/quest/object/state/mb_igshop:984: attempt to call field `give_item_with' (a nil value)

 

The Error is saying us that a quest is calling give_item_with (i guess you might find it as pc.give_item_with) which is not defined in the module (it might be pc module) and the attempt to call it returned a nil value (because can't find its function body defined). 
The way to solve it is to define the body of the function.

Usually the lua modules are defined by passing a function table e.g. here we have:

 


void RegisterPCFunctionTable()
{
  luaL_reg pc_functions[] =
    {
    { "get_wear",		pc_get_wear			},
    { "get_player_id",	pc_get_player_id	},
    { "get_account_id", pc_get_account_id	},
    { "get_account",	pc_get_account		},
    //[........]
    //[........]
    //[........]			
    { NULL,			NULL			}
  };

  CQuestManager::instance().AddLuaFunctionTable("pc", pc_functions);
}

 

As you can see here we have a list of methods defined by giving them a name (callable from lua) and a definition which is defined in the .cpp file (e.g. questlua_pc.cpp)

 

Conclusion is that you need to define your function which is giving you that error and to add it to the appropriate function table.

 

Thats my RegisterPCFunctionTable()

    void RegisterPCFunctionTable()
    {
        luaL_reg pc_functions[] = 
        {
/////////ETC,ETC/////////////////

            { "get_channel_id",        pc_get_channel_id    },

            { "give_poly_marble",    pc_give_poly_marble    },
            { "get_sig_items",        pc_get_sig_items    },

            { "charge_cash",        pc_charge_cash        },
            
            { "get_informer_type",    pc_get_informer_type    },    //µ¶ŔĎ Ľ±ą° ±â´É
            { "get_informer_item",  pc_get_informer_item    },

            { "give_award",            pc_give_award            },    //ŔĎş» °čÁ¤´ç ÇŃąřľż ±Ý±« Áö±Ţ
            { "give_award_socket",    pc_give_award_socket    },    //¸ô ŔÎşĄĹ丮żˇ ľĆŔĚĹŰ Áö±Ţ. ĽŇÄĎ ĽłÁ¤Ŕ» Ŕ§ÇŃ ÇÔĽö.

            { "get_killee_drop_pct",    pc_get_killee_drop_pct    }, /* mob_vnum.kill ŔĚşĄĆ®żˇĽ­ killeeżÍ pcżÍŔÇ level Â÷ŔĚ, pcŔÇ ÇÁ¸®ąĚľö µĺ¶ř·ü µîµîŔ» °í·ÁÇŃ ľĆŔĚĹŰ µĺ¶ř Č®·ü.
            { "give_item_with", pc_give_item_with },                                                        * return °ŞŔş (şĐŔÚ, şĐ¸đ).
                                                                    * (¸»ŔĚ şąŔâÇѵĄ, CreateDropItemŔÇ GetDropPctŔÇ iDeltaPercent, iRandRange¸¦ returnÇŃ´Ů°í ş¸¸é µĘ.)                                                        * (ŔĚ ¸»ŔĚ ´ő ľî·Áżď¶ółŞ ¤Đ¤Đ)
                                                                    * ÁÖŔÇ»çÇ× : kill eventżˇĽ­¸¸ »çżëÇŇ °Í!
                                                                    */

            { NULL,            NULL            }
        };

        CQuestManager::instance().AddLuaFunctionTable("pc", pc_functions);
    }
};
 

Any other solution? 😕

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 13

      Metin2 Closed Beta Content (2003-2004)

    2. 0

      PRESENTATION PAGE [OLDGODSMT2 RELEASE]

    3. 25

      [SRC] Metin2 on LINUX - The Old Metin2 Project

    4. 2

      United/Club/Midgard serverfiles?

    5. 13

      Metin2 Closed Beta Content (2003-2004)

    6. 13

      Metin2 Closed Beta Content (2003-2004)

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.