Jump to content
Alloder.pro: about Allods with love
Search In
  • More options...
Find results that contain...
Find results in...

New program for writers

We turn from quantity to quality and tell you how we will supplement the Allods Team program with rewards in rubles.

More

The new Updater

Let us to introduce the new addon updater software and to share the details

Read more

Alloder 2.0

We have started the process of project evolve, and this relates not only, and not even primarily of the site's view

Read more

string.match (s, pattern [, init])


icreator
 Share

Recommended Posts

а что стандартные:

string.match (s, pattern [, init])

string.gmatch (s, pattern)

не работают?

мне пишет:

Error: addon GuildCommissionaire: Error while running the chunk

Error: addon GuildCommissionaire: [string "mods/addons/guildcommissionaire/scriptgcommissionaire.lua"]:31: attempt to call field `match' (a nil value)

Error: addon GuildCommissionaire: func: match, field, line: -1, defined: C, line: -1, [c]

Error: addon GuildCommissionaire: func: ?, ?, line: 31, defined: Lua, line: 25, [string "mods/addons/guildcommissionaire/scriptgcommissionaire.lua"]

Link to comment
Share on other sites

Не разбирался в вопросе, но были ли они в луа версии 5.0.*?

Недавно столкнулся с тем что одна весьма полезная функция существует в новейшей и предыдущей версиях но отсутствует в 5.0

UPD: http://www.lua.org/manual/5.0/manual.html#5.3

Link to comment
Share on other sites

Code:
will iterate over all the words from string s, printing one per line. The next example collects all pairs key=value from the given string into a table:
  t = {}
  s = "from=world, to=Lua"
  for k, v in string.gfind(s, "(%w+)=(%w+)") do
    t [k]  = v
  end

то есть они заменили string.gmatch на это string.gfind
Link to comment
Share on other sites

как раз find есть щас

Code:

cmd = string.lower(cmd) .. " "

--- выделим из командной строчки параметры "/lc wcc:NEED, ll=greed, smart:on, lln=5"

for k, v in string.gfind(cmd, "%s*(.-) [=:] (.-) [%s%p] +" ) do

LogInfo(" [", k, "] :=", v)

end

вот как я выделяю параметры с их значениями из строки

Link to comment
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.

Guest
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.

 Share

×
×
  • Create New...

Important Information

By using our site you agree to the Terms of Use