• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[C++] getItemDescription(uid) lua function returning empty string?

Tufte

Member
Joined
Nov 19, 2007
Messages
652
Reaction score
24
Location
Norway
So I made this lua function, but it returns an empty string whether the item has a special description or not. Anyone knows why and how to fix it?

Code:
int32_t LuaScriptInterface::luaGetItemDesc(lua_State* L)
{
    //getItemDesc(uid)
    uint32_t uid = popNumber(L);

    ScriptEnvironment* env = getScriptEnv();

    Item* item = env->getItemByUID(uid);
    if (!item) {
        reportErrorFunc(getErrorDesc(LUA_ERROR_ITEM_NOT_FOUND));
        pushBoolean(L, false);
        return 1;
    }
    else {
        const std::string& specialDescription = item->getSpecialDescription();
        pushString(L, specialDescription);

    }

    pushBoolean(L, true);
    return 1;
}
 
Back
Top