{"id":455194,"date":"2025-04-08T15:02:12","date_gmt":"2025-04-08T15:02:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=455194"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=455194","title":{"rendered":"<span>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Lua: \u043f\u043e\u0447\u0435\u043c\u0443 \u0441\u0442\u043e\u0438\u0442 \u0435\u0433\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0438 \u043a\u0430\u043a \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 Go<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>Lua \u2014 \u044d\u0442\u043e \u043b\u0451\u0433\u043a\u0438\u0439, \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438 \u0433\u0438\u0431\u043a\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 1993 \u0433\u043e\u0434\u0443. \u041e\u043d \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 C \u0438 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435 \u043a\u0430\u043a \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044f\u0437\u044b\u043a, \u0430 \u043a\u0430\u043a <strong>\u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442<\/strong> \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0433\u0440\u0430\u043b\u0438 \u0432 World of Warcraft \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b\u0438 \u0430\u0434\u0434\u043e\u043d\u044b, \u0432\u044b \u0443\u0436\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 Lua. Redis \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442 Lua-\u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f. Nginx \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0435\u0433\u043e \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0412 NeoVim \u043f\u043b\u0430\u0433\u0438\u043d\u044b \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 Lua. \u041a\u043e\u0440\u043e\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u2014 \u044f\u0437\u044b\u043a \u043d\u0435 \u0438\u0437 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0442\u043e\u043f\u043e\u0432, \u043d\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0438 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f.<\/p>\n<h3>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 Lua: \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e<\/h3>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0438:<\/p>\n<pre><code class=\"lua\">print(\"Hello, World!\")<\/code><\/pre>\n<p>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 Lua \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 Pascal \u0438 Python: \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0442\u0441\u044f end, \u0442\u0438\u043f\u044b \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e \u2014 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0438 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043e\u0432.<\/p>\n<p>\u0412 \u044f\u0437\u044b\u043a\u0435 \u0435\u0441\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435:<\/p>\n<ul>\n<li>\n<p>\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 local \u0438 \u0436\u0438\u0432\u0443\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0431\u043b\u043e\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u2014 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u041e\u043d\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 _G, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0438\u0437 \u043b\u044e\u0431\u043e\u0433\u043e \u043a\u0443\u0441\u043a\u0430 \u043a\u043e\u0434\u0430, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u0432 \u0442\u043e\u0439 \u0436\u0435 \u0441\u0440\u0435\u0434\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u044b\u0439 \u2014 \u0437\u0430\u0434\u0430\u0447\u0430 \u0438\u0437 <a href=\"https:\/\/adventofcode.com\/2022\/day\/1\" rel=\"noopener noreferrer nofollow\">Advent of Code 2022, \u0434\u0435\u043d\u044c 1<\/a>:<br \/> \u041d\u0430\u0439\u0442\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0443\u043c\u043c\u0443 \u0447\u0438\u0441\u0435\u043b, \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0431\u043b\u043e\u043a\u0430\u043c, \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438.<\/p>\n<pre><code class=\"lua\">local max, current = 0, 0 for line in io.lines(\"input.txt\") do     if line == \"\" then         if current &gt; max then             max = current         end         current = 0     else         current = current + tonumber(line)     end end  if current &gt; max then     max = current end  print(max) <\/code><\/pre>\n<h3>\u0422\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Lua<\/h3>\n<p>\u0412 Lua \u0432\u0441\u0435\u0433\u043e \u0432\u043e\u0441\u0435\u043c\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<pre><code>number, string, boolean, nil, function, table, thread, userdata <\/code><\/pre>\n<h4>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u044e\u0430\u043d\u0441\u043e\u0432:<\/h4>\n<ul>\n<li>\n<p><code>number<\/code> \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u0438 \u0446\u0435\u043b\u044b\u0435, \u0438 \u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430.<\/p>\n<\/li>\n<li>\n<p><code>string<\/code> \u2014 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u043c\u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><code>nil<\/code> \u2014 Null, Nil, None \u043d\u0430\u0437\u044b\u0432\u0430\u0439 \u043a\u0430\u043a \u0445\u043e\u0447\u0435\u0448\u044c.<\/p>\n<\/li>\n<li>\n<p><code>function<\/code> \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430: \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><code>table<\/code> \u2014 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445: \u043c\u0430\u0441\u0441\u0438\u0432 (\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441 1), \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u2014 \u0432\u0441\u0451 \u0432 \u043e\u0434\u043d\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p><code>thread<\/code> \u2014 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b.<\/p>\n<\/li>\n<li>\n<p><code>userdata<\/code> \u2014 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 C-\u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438 \u0441\u043b\u0430\u0431\u0430\u044f: \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043c\u0435\u043d\u044f\u0442\u044c \u0442\u0438\u043f \u043d\u0430 \u043b\u0435\u0442\u0443, \u0430 Lua \u0447\u0430\u0441\u0442\u043e \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u00ab\u0443\u0433\u0430\u0434\u0430\u0442\u044c\u00bb \u0432\u0430\u0448\u0443 \u0437\u0430\u0434\u0443\u043c\u043a\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0442\u0440\u043e\u043a\u0443 <code>\"42\"<\/code> \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u044f\u0432\u043d\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0432 \u0447\u0438\u0441\u043b\u043e. \u0410 \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u044f\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432, \u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>tonumber(n)<\/code>  \u0438\u043b\u0438 <code>tostring(s)<\/code>.<\/p>\n<h3>\u0412\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c: \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0438\u043b\u0430 Lua<\/h3>\n<p>Lua \u0443\u0434\u043e\u0431\u043d\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u043b\u044e\u0431\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 C \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 Go. \u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <a href=\"https:\/\/www.lua.org\/pil\/24.html\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0441\u0442\u043e\u0439 C API<\/a>, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u044f\u0437\u044b\u043a \u043d\u043e\u0432\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440: \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u044c Lua-\u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0437 Go<\/h4>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0435\u0441\u0442\u044c Lua-\u0444\u0430\u0439\u043b <code>fib5.lua<\/code> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u0424\u0438\u0431\u043e\u043d\u0430\u0447\u0447\u0438 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u043b\u044f \u0447\u0438\u0441\u043b\u0430 5.<\/p>\n<pre><code class=\"lua\">function fib(n)     local fib = {1, 1}      for i = 3,n,1 do         fib[#fib+1] = fib[#fib] + fib[#fib-1]     end     return fib[n] end return fib(5)<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430 Go:<\/p>\n<p>\u042f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/github.com\/yuin\/gopher-lua\" rel=\"noopener noreferrer nofollow\">github.com\/yuin\/gopher-lua<\/a> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043d\u043e \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e CGO.<\/p>\n<pre><code class=\"go\">package main  import ( \"fmt\"  lua \"github.com\/yuin\/gopher-lua\" )  func main() { var l *lua.LState = lua.NewState() defer l.Close() if err := l.DoFile(\"fib5.lua\"); err != nil { panic(err) }  \/\/ \u0434\u043e\u0441\u0442\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0441\u0442\u044d\u043a\u0430 result := l.Get(-1) \/\/ result \u0442\u0438\u043f\u0430 lua.LValue \/\/ \u0438 \u043e\u0447\u0438\u0449\u0430\u0435\u043c \u0435\u0433\u043e l.Pop(1) fmt.Printf(\"result: %d\\n\", result) \/\/ result: 5 } <\/code><\/pre>\n<p>E\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u0437\u0430\u043d\u043e\u0432\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u043e\u0434\u0441\u0447\u0435\u0442, \u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0430\u0434\u043e \u0437\u0430\u043d\u043e\u0432\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0444\u0430\u0439\u043b, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>fib(n)<\/code> \u0443\u0436\u0435 \u043b\u0435\u0436\u0438\u0442 \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043d\u0430\u0448\u0435\u0433\u043e <code>l *lua.LState<\/code> \u041d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u044c \u0435\u0451 \u043e\u0442\u0442\u0443\u0434\u0430 \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u0441\u0442\u044d\u043a \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>l.Call(nargs, nret)<\/code> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<pre><code class=\"go\">... \/\/\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u0441\u0442\u044d\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 l.Push(l.GetGlobal(\"fib\")) \/\/ stack: function \"fib\" \/\/\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u0441\u0442\u044d\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 l.Push(lua.LNumber(15))    \/\/ stack: function \"fib\", 15 \/\/ l.Call \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u0438\u0437 \u0441\u0442\u044d\u043a\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 1 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u043e 1 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 l.Call(1, 1)               \/\/ stack: 610 result = l.Get(-1)         \/\/ stack: 610 l.Pop(1)                   \/\/ stack: fmt.Printf(\"result: %d\\n\", result) \/\/result: 610 <\/code><\/pre>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0435: \u043d\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432 2 \u044f\u0437\u044b\u043a\u0430\u0445 \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u044b), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0430\u0441\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<h3>\u0413\u0434\u0435 Lua \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f<\/h3>\n<p>Lua \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445:<\/p>\n<ul>\n<li>\n<p><strong>World of Warcraft<\/strong> \u2014 \u0430\u0434\u0434\u043e\u043d\u044b \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<\/li>\n<li>\n<p><strong>Redis<\/strong> \u2014 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p><strong>Nginx<\/strong> \u2014 \u043c\u043e\u0434\u0443\u043b\u044c ngx_http_lua_module.<\/p>\n<\/li>\n<li>\n<p><strong>NeoVim<\/strong> \u2014 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 API \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u0418\u0433\u0440\u043e\u0432\u044b\u0435 \u0434\u0432\u0438\u0436\u043a\u0438<\/strong> \u2014 Defold, Pico-8, Love2D \u0438 \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0417\u0430\u0447\u0435\u043c \u0443\u0447\u0438\u0442\u044c Lua \u0432 2025 \u0433\u043e\u0434\u0443?<\/h3>\n<p>Lua \u2014 \u043d\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043d\u0430 \u0432\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0436\u0438\u0437\u043d\u0438. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b:<\/p>\n<ul>\n<li>\n<p>\u043f\u0438\u0448\u0435\u0442\u0435 backend \u043d\u0430 Nginx \u0438\u043b\u0438 Redis,<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 NeoVim \u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d\u044b,<\/p>\n<\/li>\n<li>\n<p>\u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a \u0432 \u0441\u0432\u043e\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435,<\/p>\n<\/li>\n<\/ul>\n<p>&#8230; \u0442\u043e Lua \u2014 \u044d\u0442\u043e \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u041e\u043d \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439, \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438 \u0433\u0438\u0431\u043a\u0438\u0439. \u0418 \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u2014 \u043f\u0440\u0438\u044f\u0442\u043d\u043e \u0443\u0434\u0438\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0435\u0439 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/898828\/\"> https:\/\/habr.com\/ru\/articles\/898828\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>Lua \u2014 \u044d\u0442\u043e \u043b\u0451\u0433\u043a\u0438\u0439, \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438 \u0433\u0438\u0431\u043a\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0432 1993 \u0433\u043e\u0434\u0443. \u041e\u043d \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 C \u0438 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435 \u043a\u0430\u043a \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u044f\u0437\u044b\u043a, \u0430 \u043a\u0430\u043a <strong>\u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442<\/strong> \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0433\u0440\u0430\u043b\u0438 \u0432 World of Warcraft \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b\u0438 \u0430\u0434\u0434\u043e\u043d\u044b, \u0432\u044b \u0443\u0436\u0435 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0441 Lua. Redis \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442 Lua-\u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f. Nginx \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0435\u0433\u043e \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u0412 NeoVim \u043f\u043b\u0430\u0433\u0438\u043d\u044b \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 Lua. \u041a\u043e\u0440\u043e\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f \u2014 \u044f\u0437\u044b\u043a \u043d\u0435 \u0438\u0437 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0442\u043e\u043f\u043e\u0432, \u043d\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0438 \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f.<\/p>\n<h3>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 Lua: \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043f\u043e\u043d\u044f\u0442\u043d\u043e<\/h3>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0438:<\/p>\n<pre><code class=\"lua\">print(\"Hello, World!\")<\/code><\/pre>\n<p>\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 Lua \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442 Pascal \u0438 Python: \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0442\u0441\u044f end, \u0442\u0438\u043f\u044b \u0432\u044b\u0432\u043e\u0434\u044f\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u0432\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e \u2014 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0438 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043e\u0432.<\/p>\n<p>\u0412 \u044f\u0437\u044b\u043a\u0435 \u0435\u0441\u0442\u044c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0438 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435:<\/p>\n<ul>\n<li>\n<p>\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 local \u0438 \u0436\u0438\u0432\u0443\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0431\u043b\u043e\u043a\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u2014 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u041e\u043d\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 _G, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0439 \u0438\u0437 \u043b\u044e\u0431\u043e\u0433\u043e \u043a\u0443\u0441\u043a\u0430 \u043a\u043e\u0434\u0430, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0433\u043e \u0432 \u0442\u043e\u0439 \u0436\u0435 \u0441\u0440\u0435\u0434\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u043d\u044b\u0439 \u2014 \u0437\u0430\u0434\u0430\u0447\u0430 \u0438\u0437 <a href=\"https:\/\/adventofcode.com\/2022\/day\/1\" rel=\"noopener noreferrer nofollow\">Advent of Code 2022, \u0434\u0435\u043d\u044c 1<\/a>:<br \/> \u041d\u0430\u0439\u0442\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0443\u043c\u043c\u0443 \u0447\u0438\u0441\u0435\u043b, \u0441\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u0431\u043b\u043e\u043a\u0430\u043c, \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u043c \u043f\u0443\u0441\u0442\u044b\u043c\u0438 \u0441\u0442\u0440\u043e\u043a\u0430\u043c\u0438.<\/p>\n<pre><code class=\"lua\">local max, current = 0, 0 for line in io.lines(\"input.txt\") do     if line == \"\" then         if current &gt; max then             max = current         end         current = 0     else         current = current + tonumber(line)     end end  if current &gt; max then     max = current end  print(max) <\/code><\/pre>\n<h3>\u0422\u0438\u043f\u044b \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 Lua<\/h3>\n<p>\u0412 Lua \u0432\u0441\u0435\u0433\u043e \u0432\u043e\u0441\u0435\u043c\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0442\u0438\u043f\u043e\u0432:<\/p>\n<pre><code>number, string, boolean, nil, function, table, thread, userdata <\/code><\/pre>\n<h4>\u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u044e\u0430\u043d\u0441\u043e\u0432:<\/h4>\n<ul>\n<li>\n<p><code>number<\/code> \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0435\u0442 \u0438 \u0446\u0435\u043b\u044b\u0435, \u0438 \u0434\u0440\u043e\u0431\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430.<\/p>\n<\/li>\n<li>\n<p><code>string<\/code> \u2014 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u043c\u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><code>nil<\/code> \u2014 Null, Nil, None \u043d\u0430\u0437\u044b\u0432\u0430\u0439 \u043a\u0430\u043a \u0445\u043e\u0447\u0435\u0448\u044c.<\/p>\n<\/li>\n<li>\n<p><code>function<\/code> \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430: \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c, \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0438\u0437 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439.<\/p>\n<\/li>\n<li>\n<p><code>table<\/code> \u2014 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445: \u043c\u0430\u0441\u0441\u0438\u0432 (\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441 1), \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u0438 \u043e\u0431\u044a\u0435\u043a\u0442 \u2014 \u0432\u0441\u0451 \u0432 \u043e\u0434\u043d\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p><code>thread<\/code> \u2014 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b.<\/p>\n<\/li>\n<li>\n<p><code>userdata<\/code> \u2014 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 C-\u0434\u0430\u043d\u043d\u044b\u043c\u0438.<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438 \u0441\u043b\u0430\u0431\u0430\u044f: \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043c\u0435\u043d\u044f\u0442\u044c \u0442\u0438\u043f \u043d\u0430 \u043b\u0435\u0442\u0443, \u0430 Lua \u0447\u0430\u0441\u0442\u043e \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u00ab\u0443\u0433\u0430\u0434\u0430\u0442\u044c\u00bb \u0432\u0430\u0448\u0443 \u0437\u0430\u0434\u0443\u043c\u043a\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0442\u0440\u043e\u043a\u0443 <code>\"42\"<\/code> \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u044f\u0432\u043d\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0432 \u0447\u0438\u0441\u043b\u043e. \u0410 \u0435\u0441\u043b\u0438 \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u044f\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u043e\u0432, \u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0442\u0430\u043a\u043e\u0433\u043e: \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>tonumber(n)<\/code>  \u0438\u043b\u0438 <code>tostring(s)<\/code>.<\/p>\n<h3>\u0412\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c: \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0438\u043b\u0430 Lua<\/h3>\n<p>Lua \u0443\u0434\u043e\u0431\u043d\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 \u043b\u044e\u0431\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u043d\u0430 C \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 Go. \u0418\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 <a href=\"https:\/\/www.lua.org\/pil\/24.html\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0441\u0442\u043e\u0439 C API<\/a>, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u043e\u0431\u043c\u0435\u043d\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u044f\u0437\u044b\u043a \u043d\u043e\u0432\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438.<\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440: \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u043d\u0438\u0442\u044c Lua-\u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0437 Go<\/h4>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c \u0435\u0441\u0442\u044c Lua-\u0444\u0430\u0439\u043b <code>fib5.lua<\/code> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0447\u0438\u0441\u043b\u043e \u0424\u0438\u0431\u043e\u043d\u0430\u0447\u0447\u0438 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u043b\u044f \u0447\u0438\u0441\u043b\u0430 5.<\/p>\n<pre><code class=\"lua\">function fib(n)     local fib = {1, 1}      for i = 3,n,1 do         fib[#fib+1] = fib[#fib] + fib[#fib-1]     end     return fib[n] end return fib(5)<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0430 Go:<\/p>\n<p>\u042f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/github.com\/yuin\/gopher-lua\" rel=\"noopener noreferrer nofollow\">github.com\/yuin\/gopher-lua<\/a> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043d\u043e \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0438 \u0431\u0435\u0437 \u043b\u0438\u0448\u043d\u0438\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e CGO.<\/p>\n<pre><code class=\"go\">package main  import ( \"fmt\"  lua \"github.com\/yuin\/gopher-lua\" )  func main() { var l *lua.LState = lua.NewState() defer l.Close() if err := l.DoFile(\"fib5.lua\"); err != nil { panic(err) }  \/\/ \u0434\u043e\u0441\u0442\u0430\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0441 \u0432\u0435\u0440\u0448\u0438\u043d\u044b \u0441\u0442\u044d\u043a\u0430 result := l.Get(-1) \/\/ result \u0442\u0438\u043f\u0430 lua.LValue \/\/ \u0438 \u043e\u0447\u0438\u0449\u0430\u0435\u043c \u0435\u0433\u043e l.Pop(1) fmt.Printf(\"result: %d\\n\", result) \/\/ result: 5 } <\/code><\/pre>\n<p>E\u0441\u043b\u0438 \u043c\u044b \u0437\u0430\u0445\u043e\u0442\u0438\u043c \u0437\u0430\u043d\u043e\u0432\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u043e\u0434\u0441\u0447\u0435\u0442, \u0442\u043e \u043d\u0430\u043c \u043d\u0435 \u043d\u0430\u0434\u043e \u0437\u0430\u043d\u043e\u0432\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0444\u0430\u0439\u043b, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>fib(n)<\/code> \u0443\u0436\u0435 \u043b\u0435\u0436\u0438\u0442 \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043d\u0430\u0448\u0435\u0433\u043e <code>l *lua.LState<\/code> \u041d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u044c \u0435\u0451 \u043e\u0442\u0442\u0443\u0434\u0430 \u0438 \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u0441\u0442\u044d\u043a \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438, \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u0432\u0430\u0442\u044c <code>l.Call(nargs, nret)<\/code> \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430.<\/p>\n<pre><code class=\"go\">... \/\/\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u0441\u0442\u044d\u043a \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438\u0437 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 l.Push(l.GetGlobal(\"fib\")) \/\/ stack: function \"fib\" \/\/\u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u0441\u0442\u044d\u043a \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 l.Push(lua.LNumber(15))    \/\/ stack: function \"fib\", 15 \/\/ l.Call \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u0438\u0437 \u0441\u0442\u044d\u043a\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 1 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442, \u0438 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u043e 1 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 l.Call(1, 1)               \/\/ stack: 610 result = l.Get(-1)         \/\/ stack: 610 l.Pop(1)                   \/\/ stack: fmt.Printf(\"result: %d\\n\", result) \/\/result: 610 <\/code><\/pre>\n<p>\u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0435: \u043d\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0435 \u0442\u0438\u043f\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0435 \u0432 2 \u044f\u0437\u044b\u043a\u0430\u0445 \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043c\u0430\u0441\u0441\u0438\u0432\u044b), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0430\u0441\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<h3>\u0413\u0434\u0435 Lua \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f<\/h3>\n<p>Lua \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445:<\/p>\n<ul>\n<li>\n<p><strong>World of Warcraft<\/strong> \u2014 \u0430\u0434\u0434\u043e\u043d\u044b \u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441.<\/p>\n<\/li>\n<li>\n<p><strong>Redis<\/strong> \u2014 \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p><strong>Nginx<\/strong> \u2014 \u043c\u043e\u0434\u0443\u043b\u044c ngx_http_lua_module.<\/p>\n<\/li>\n<li>\n<p><strong>NeoVim<\/strong> \u2014 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0439 API \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u0418\u0433\u0440\u043e\u0432\u044b\u0435 \u0434\u0432\u0438\u0436\u043a\u0438<\/strong> \u2014 Defold, Pico-8, Love2D \u0438 \u0434\u0440\u0443\u0433\u0438\u0435.<\/p>\n<\/li>\n<\/ul>\n<h3>\u0417\u0430\u0447\u0435\u043c \u0443\u0447\u0438\u0442\u044c Lua \u0432 2025 \u0433\u043e\u0434\u0443?<\/h3>\n<p>Lua \u2014 \u043d\u0435 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u044f\u0437\u044b\u043a \u043d\u0430 \u0432\u0441\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u0436\u0438\u0437\u043d\u0438. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b:<\/p>\n<ul>\n<li>\n<p>\u043f\u0438\u0448\u0435\u0442\u0435 backend \u043d\u0430 Nginx \u0438\u043b\u0438 Redis,<\/p>\n<\/li>\n<li>\n<p>\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 NeoVim \u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043b\u0430\u0433\u0438\u043d\u044b,<\/p>\n<\/li>\n<li>\n<p>\u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u043e\u0442\u0438\u0442\u0435 \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a \u0432 \u0441\u0432\u043e\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435,<\/p>\n<\/li>\n<\/ul>\n<p>&#8230; \u0442\u043e Lua \u2014 \u044d\u0442\u043e \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u041e\u043d \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0439, \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0438 \u0433\u0438\u0431\u043a\u0438\u0439. \u0418 \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 \u2014 \u043f\u0440\u0438\u044f\u0442\u043d\u043e \u0443\u0434\u0438\u0432\u043b\u044f\u0435\u0442 \u0441\u0432\u043e\u0435\u0439 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u043e\u0441\u0442\u044c\u044e.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/898828\/\"> https:\/\/habr.com\/ru\/articles\/898828\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-455194","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/455194","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=455194"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/455194\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=455194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=455194"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=455194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}