Jump to content

getName() is an inappropriate function

Recommended Posts

-- when you or a npc try to hit something
xpUpdate.onWeaponHitXp = function(owner, weapon, hitObject, damage)
    local isShove = false
    if hitObject:isOnFloor() == false and weapon:getName() == "Bare Hands" then

The function getName() returns translated name! It may be not English.

So it should be:

weapon:getType() == "BareHands"


Share this post

Link to post
Share on other sites
Posted (edited)

The result of getName() is equal to getDisplayName().

But getType() is better anyway in this code.





Edited by Maris

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...