caquinha
Member
- Joined
- Aug 8, 2016
- Messages
- 248
- Solutions
- 1
- Reaction score
- 24
how to deal with returns in LUA?
i tried to create some global functions like:
data/lib/usual.lua
action
its printing
why?
i tried to create some global functions like:
data/lib/usual.lua
Code:
function getBaseVocation(cid)
local voc = getPlayerVocation(cid)
print("1 data/lib/common.lua voc: " .. voc)
if voc == 1 or voc == 4 or voc == 5 or voc == 6 or voc == 7 then
return 1
elseif voc == 2 or voc == 8 or voc == 9 or voc == 10 then
return 2
elseif voc == 3 or voc == 11 or voc == 12 or voc == 13 or voc == 14 or voc == 15 or voc == 16 or voc == 17 then
return 3
elseif voc == 0 then
return 0
end
end
action
Code:
function onUse(cid, item, frompos, item2, topos)
print("[action] voc -> " .. getPlayerVocation(cid))
print("[action] baseVocation -> " .. getBaseVocation(cid))
end
its printing
Code:
[action] voc -> 3
[action] baseVocation -> 268541257
why?
Last edited: