|
楼主 |
发表于 2013-7-28 23:08:12
|
显示全部楼层
自問自答第一次的v==s只是找一不一樣
有人幫我提示用string.find
string.find就直接找到部份相同就可以了
- getitem=function(s)
- function isin(s,t)
- for i, v in ipairs(t) do
- if string.find(s,v)then
- return true
- end -- if
- end -- for
- end -- isin
- local item_table = {"補天石","冰蠶絲","玄冰寒鐵","龍血","金塊","烏金絲","青龍彩晶","名號","武曲","文曲","晶砂","骷髏\頭","寶石","丹","符文","天隕","冰柱","寒鋼","丸"}
- if isin (s,item_table) then
- Execute("get "..s.."")
- end -- if
- end -- getitem
复制代码 |
|