Ukoresheje imvugo ya Lua, urashobora gukora imikino itandukanye, ibikorwa,
imashini za robo nubundi buryo bwiterambere. Ururimi rwa Lua rworoshye kubyumva, rufite umusemuzi uzwi. Birasabwa kumenyana na Lua hafi, ndetse no kwiga kwandika robot cyangwa inyandiko yubucuruzi muri uru rurimi.
- Ururimi rwa Lua ni uruhe kandi ni ingirakamaro gute?
- Amakuru magufi
- Ibiranga ururimi rwa Lua
- Ibyiza n’ibibi
- Gereranya na Javascript
- Ibiranga porogaramu za robo zo gucuruza mu rurimi rwa Lua
- Incamake yimashini nziza yubucuruzi kuri Lua – ibisubizo byateguwe kubatangiye
- Imashini yimashini “Delta Pro”
- RQ: Ijanisha rimwe
- RQ: Martin
- Ubwoko bwa Lua Inyandiko ya QUIK
- Nigute wandika robot muri Lua
- Nigute ushobora gukora progaramu muri LUA muri QUIK
- Nigute ushobora gushiraho inyandiko ya LUA mubucuruzi bwubucuruzi
Ururimi rwa Lua ni uruhe kandi ni ingirakamaro gute?
Lua biroroshye gukoresha imvugo yashyizwemo. Abitangira bemera ko nubufasha bwayo, ushobora kwiga shingiro rya programming mugihe gito. Lua ihujwe neza niterambere ryakozwe mu rundi rurimi. Bikunze gusabwa kubanyeshuri batangiye siyanse yubushakashatsi bwa elegitoroniki.
Ururimi rwa Lua rukoreshwa kenshi mubice bitandukanye. Irashobora gukenerwa:
- Umukoresha ukina imikino ya mudasobwa (andika amacomeka).
- Inzobere mu guteza imbere umukino (guteza imbere moteri).
- Porogaramu yo guteza imbere porogaramu (andika amacomeka kubikorwa bitandukanye).
- Iterambere mu cyerekezo cyashyizwemo (ururimi ntirudindiza inzira kandi rugufasha gukora neza)
- Abacuruzi kugirango bandike inyandiko na bots. . _
Ndashimira Lua, hashyizweho robot zirenga imwe yubucuruzi. Akarusho nuko buri mukoresha ashobora kumva byihuse imiterere yururimi kandi yigenga agakora progaramu nkiyi. Binyuze muri yo, bizashoboka kohereza amategeko kuri
Quik terminal no gukora isesengura rya tekiniki. Ururimi rwa Lua ni uruhe, incamake y’ururimi rwa porogaramu ya LUA: https://youtu.be/PbYf6uNZFCE
Amakuru magufi
Lua yahimbwe mu 1993 nabashinzwe porogaramu bo muri Berezile bo mu gice cya Tecgraf. Abashinzwe iterambere bemeje neza ko buri mukoresha ashobora kugira ibyo ahindura mugutezimbere ururimi. Ibi birashobora gukorwa binyuze kumugaragaro kuri kode. Kuri Berezile, kugaragara kwururimi rwarwo rwo gutangiza gahunda byari ibintu byavumbuwe. Mubyukuri, mbere yibyo, iki gihugu nticyigeze kigera ku ntsinzi nkiyi mu rwego rwo guteza imbere mudasobwa.
Ururimi rwakozwe hashingiwe kuri SOL na DEL. Iterambere ryabonye isi mbere yumwaka kurusha Lua. Umuryango umwe wo muri Berezile wakoze nkumwanditsi. Izi ndimi zo gutangiza gahunda zashinzwe na Petrobras, isosiyete yo muri leta imwe ikora mu gucukura no gutunganya amavuta. Verisiyo iheruka ya Lua 5.4.0 yasohotse ugereranije vuba aha – muri 2020. Abashinzwe iterambere bagerageza kumenyekanisha ibintu bishimishije kandi byingirakamaro mumushinga kenshi gashoboka. Kubwibyo, gahunda ihora ivugururwa kandi irakenewe mubateza imbere.
Ibiranga ururimi rwa Lua
Guhangana na Lua, uwatezimbere ahabwa amahirwe yo gukoresha uru rurimi, rwubatswe (bitewe nuko rwanditswe) hamwe na standalone (mubihe bimwe na bimwe, rushobora gukoreshwa nta on-ons). Iyo abanditsi bakoze ku irema rya Lua, bagiye nkana gukora igikoresho gikora kidafata umwanya munini kandi kizakora byoroshye kubikoresho byose.
Abashinzwe iterambere bagerageje koroshya uru rurimi uko bishoboka kwose, kugirango na programmes bashya bashobore kuyimenya vuba. Nibisabwa byiyongera kumushinga. Inzobere zifite amahirwe yo kwandika code no gukora ibintu binini byiterambere bitabaje amasomero kurubuga rwemewe. Abanditsi bitaye ku kuboneka kw’ibipimo bikenewe muri gahunda ubwayo. Abakoresha bashya bakunda kwiga mubice bikoreshwa ururimi rwa Lua. Yashizweho kugirango itange gahunda mu rwego rwinganda. Ariko uyumunsi, hifashishijwe uru rurimi, robot zitandukanye zubucuruzi, inyandiko, imikino ya mudasobwa, porogaramu, bots za Telegramu, nibindi biraremwa. Mubyongeyeho, Lua agira uruhare mubuhanga bushya bufasha gushakisha umwanya. Ikoreshwa kandi mu kwigisha abanyeshuri muri kaminuza. Ururimi ruzwi cyane rwa porogaramu Lua ifatwa murugo. Muri Berezile niho ikoreshwa hafi ya hose (aho bishoboka).
Ibyiza n’ibibi
Kimwe na porogaramu iyo ari yo yose, uburyo n’imvugo ya Lua bifite umubare wibyiza n’ibibi. Birakwiye gutangirira kubintu byiza byiterambere:
- Ubwikorezi bwiza . Bitandukanye na gahunda nyinshi, Lua biroroshye kwimura sisitemu imwe ikora indi. Muri uru rubanza, nta mpinduka nini zihari. Ibyo ari byo byose, ntihazabaho amakosa muri kode.
- Amasomero menshi . Ugereranije na JavaScript , Lua ifite amahitamo make y’ibitabo. Nyamara, ibikoresho byemewe bifite ibyo ukeneye byose kugirango ukore byuzuye nururimi.
- Gukora neza . Sisitemu igufasha kongeramo ayo masomero afite akamaro kubikorwa runaka bya code mugihe gito.
- Kuborohereza gukoresha . Porogaramu ya gurus ikeneye gusa kwiga amakuru make yururimi, kandi hanyuma barashobora kuyakoresha neza mumajyambere yabo. Kubatangiye gusa na programming, ntibisaba igihe kinini kugirango wumve Lua.
- Kuzigama cyane . Mugukora progaramu mururwo rurimi, umuhanga yemerewe kubona itandukaniro nibindi bisa. Nyuma ya byose, iterambere rya Lua rikeneye kwibuka bike kubikoresho.
Gusa ikibi gikomeye cyururimi nuko rwanditswe. Kandi ibi bivuze ko akenshi ishobora gukoreshwa gusa hamwe nizindi ndimi ziterambere. Icyamamare muri ibi ni C. Nukuvuga ko, ugomba kwiga ururimi rwinyongera.
Gereranya na Javascript
Abakoresha benshi bagereranya Lua na JavaScript, bavuga ko code zabo ari zimwe. Hano mubyukuri hari byinshi bisa hagati yindimi kuruta gutandukana. Ariko, nubwo bisa nkaho bigaragara, hariho itandukaniro ryinshi. Kurugero, Lua ifite inkunga yayo ya software. Ariko, abategura JavaScript baherutse kwerekana ivugurura, ukurikije, uyikoresha akeneye kwandika ijambo “umusaruro” hagati ya generator, nyuma yaho gahunda ikazashyigikirwa.
Umukoresha wa Lua kugirango azamure imbaraga yerekana ikimenyetso nkiki “^”, mugihe muri JavaScript ni “**”. Iheruka ifite zoom no gukuza imikorere. Ariko Lua arashobora gukora ibikorwa birenze urugero. JavaScript ikubiyemo imikorere ihinduka gusa, mugihe Lua yabisobanuye. JavaScript irashobora kwirata ko ishyigikiye bizwi cyane Unicode. Gukomatanya “! ==” bikoreshwa mu kwerekana ubusumbane mu rurimi, naho Lua akoresha “~ =” ku ntego imwe. Ibindi bitandukanye bitangwa kumeza.
Ibiranga porogaramu za robo zo gucuruza mu rurimi rwa Lua
Gukora robot kuri QLua ntabwo bigoye na gato, nabatangiye barashobora kubyitwaramo. Ikintu nyamukuru nugusobanukirwa inyigisho yibanze mugitangiriro. Kugirango uhimbe kode, umwanditsi wanditse byoroshye ni ingirakamaro. Gahunda yo kurema isa no gukusanya icyerekezo. Ariko, hariho itandukaniro rito muri code ubwayo. Ikindi cyiza “kumurika” – robot nshya yashizwe irashobora gushirwa ahantu hose kuri PC yawe.
Ni ngombwa! Hagomba kubaho imikorere imwe gusa muri kode – “nyamukuru”.
Kode ya robo imaze gukusanywa no guhindurwa, birasabwa kubika. Ntiwibagirwe kubyerekeye kwagura lua. Nkuko bimaze kuvugwa, porogaramu irashobora gushyirwa ahantu hose kuri mudasobwa. Kugerageza code yawe, ugomba gukoresha robot. Kugirango ukore ibi, jya mu gice cya “Serivisi”. Hepfo hazaba umurongo “Inyandiko za Lua”, igomba gukanda.
Ibikurikira, idirishya rifite inyandiko zipakiye zizagaragara. Hano ugomba guhitamo dosiye isabwa hanyuma ukayikoresha ukoresheje buto ikwiye.
Mugusoza, birasabwa kugenzura code ya bot amakosa. Niba byose ari byiza, robot izatangira. Mugihe cyakubiswe, birakwiye ko wongera gusubira kuri kode ukareba niba ari ukuri.
Incamake yimashini nziza yubucuruzi kuri Lua – ibisubizo byateguwe kubatangiye
Ukoresheje imvugo ya Lua, urashobora gukora ubwoko butandukanye bwa robo yibintu byose bigoye. Ariko, urashobora kugura porogaramu yiteguye. Birasabwa kumenyana na algorithms izwi cyane yamaze kwitegura akazi. Urashobora kubigura cyangwa kugerageza verisiyo yerekana. Imashini yuzuye yubucuruzi kuri terminal ya QUIK i Lua: https://youtu.be/Z2xzOfNZFso
Imashini yimashini “Delta Pro”
Emerera gukora hafi 120 amahitamo yose kurubuga rumwe. Muri iki kibazo, urashobora gukoresha ubwoko butandukanye bwingamba nibikoresho.
RQ: Ijanisha rimwe
Robo yagenewe gucuruza mubucuruzi. Algorithm igufasha kongera amafaranga ava muriki gikorwa inshuro nyinshi. Ingaruka ziragabanuka, zirashobora kubarwa byoroshye.
RQ: Martin
Sisitemu igufasha kubara byinshi mbere yo gukora amasezerano. Gucuruza muburyo bwa “semi-automatic” biratangwa. Inzego zirashobora gukurikiranwa neza no gushyirwaho intoki.
Ubwoko bwa Lua Inyandiko ya QUIK
Mugihe ukora umurimo runaka muri terminal ya QUIK, inyandiko zikurikira zikoreshwa:
- Inyandiko ya Lua . Bashobora kubikwa kumurongo, kuri disiki yaho, cyangwa ahandi hantu bazagera kuri terminal. Zirakora bihagije kugirango zikore robot yubucuruzi nubufasha bwabo. Bizashoboka gukora imbonerahamwe muri QUIK, koresha ibikoresho byamahitamo, utange amategeko yo gukora imirimo itandukanye, nibindi.
- Ibipimo byihariye . Hano, ugereranije nuburyo bwabanje, imikorere mike cyane. Porogaramu igenewe uyikoresha kwerekana algorithm yibikorwa kumurongo wanyuma.
Gutegura porogaramu muri Lua kubashaka kumenya neza ururimi – gukuramo umurongo wuzuye:
Porogaramu muri Lua Robo i Lua kuri QUIK – robot ya iceberg: https://youtu.be/cxXwF_xmTHY
Nigute wandika robot muri Lua
Amaze gufata icyemezo cyo gukora robot ye, uyikoresha agomba gukurikiza algorithm yabanjirije. Mugihe azaba afite uburambe muri programming, azashobora kwandika byoroshye code ye kandi agerageze. Muguhitamo Lua kwiga kariya gace, uwatangiye ntazibeshya. Nyuma ya byose, mu ntangiriro, ikintu cyingenzi nuguhagarara kururimi rworoshye kandi rwumvikana. Kugirango utangire, fungura porogaramu yubucuruzi ya QUIK. Mu idirishya ryayo, ugomba gukora ububiko. Aha niho hantu inyandiko zose zanditse zizakizwa. Umukoresha arashobora guha ububiko izina iryo ariryo ryose, ariko rigomba kuba rigizwe gusa ninyuguti zikilatini. Reka tuvuge ko izina ryayo ari “LuaScriptts”. Ibikurikira, ugomba gukora paperi hanyuma ugashiraho umwanditsi mukuru, urugero, Notepad. Mu mwanya wubusa (muri idirishya rya porogaramu) ugomba gukanda iburyo
. Agasanduku k’ibiganiro kazagaragara, murutonde ukeneye guhitamo “Kurema”, hanyuma umurongo “Inyandiko”.
Igomba kandi guhabwa izina, kugirango ititiranya nyuma. Kurugero, urashobora kwandika “Inyandiko_N1”. Ntiwibagirwe kubijyanye no gukemura imvugo yakoreshejwe – .lua. Ni ukuvuga, uyikoresha agomba kubona inyandiko nkiyi ku nyandiko “Script_N1.lua”. Ariko, Windows ikunze guhindura iyaguka mu buryo bwikora ushyira dosiye .txt. Muri iki kibazo, birasabwa gukora inyandiko muri NotePad ++, ugashyiraho imyanzuro yifuzwa. Muri iyi gahunda, uzakenera guhitamo igice “Syntaxes”. Ikiganiro agasanduku hamwe namahitamo menshi azagaragara hano. Uzakenera guhitamo “L”. Kuva aho, irindi dirishya rizagaragara aho ukeneye gukanda kuri “Lua”.
Nyuma yibyo, muri menu imwe, hamwe nigice cya “Syntaxes”, ugomba gukanda kumutwe “File”. Mu idirishya ritaha hazaba hari inyandiko – “Bika nka”. Umukoresha agomba gukanda kuriyo hanyuma agategereza kugeza idirishya rishya rifunguye.
Hano, hejuru, umurongo ufite izina ryububiko bwakozwe mbere “Lua scripts” bizagaragara. Hasi yidirishya, izindi nyandiko 2 umukoresha yakoze zirerekanwa. Niba ibintu byose bihuye, ugomba kwemeza ibikorwa hanyuma ukabika uko kode igeze.
Intambwe ikurikira nukwandika code mururimi rwatoranijwe rwa Lua. Abitangira barashobora gukoresha amabwiriza, bizafasha gukora code yoroshye, kugirango umuhanga abashe kugerageza ukuboko kwe. Algorithm y’ibikorwa iri muri dosiye ya porogaramu yitwa QLUA.chm. Birasabwa, kurugero, kwandika kode yoroheje:
imikorere nyamukuru ()
ubutumwa (“Inyandiko yanjye yambere yatangijwe”);
kurangiza Ibikurikira, ugomba gukanda kuri buto yo kubika muri menu.
Kode igomba kubikwa muri dosiye “Script_N1.lua”. Turayitangiza turebe uko inyandiko yambere yerekanwe. Gufungura muri QUIK, ugomba gufungura iyi gahunda hanyuma ugahitamo “Serivisi” mugice cyamahitamo. Ibikurikira, ikiganiro kizagaragara, ngaho ugomba gukanda kuri “Inyandiko za LUA …”.
Noneho umukoresha azabona ububiko “Inyandiko ziboneka”. Kuruhande rwiburyo hejuru ni Ongeraho buto. Kanda hanyuma urebe dosiye hamwe na kode. Iherereye hano “Inyandiko_N1.lua”.
Mugihe ufunguye inyandiko, ni ngombwa guhitamo umurongo “Script_N1.lua” (igomba kubikwa kuri drive C), hanyuma, hepfo, kanda kuri bouton “Kwiruka”.
Idirishya rishya rizahita rigaragara.
Kugira ngo wirinde izo nyuguti zidasobanutse, ugomba kujya kuri gahunda ya NotePad. Igenamiterere hari igice “Encodings”, kanda kuriyo. Noneho urutonde rwibisobanuro ruzagaragara, muribwo ugomba gukanda kuri “Hindura kuri ANSI”.
Ibikurikira, ugomba gukanda kuri buto yo kubika hanyuma ugasubira mubutumwa bwidirishya. Hazaba hari ikindi cyanditswe, kandi ntabwo umurongo ufite abanditsi.
Nigute ushobora gukora progaramu muri LUA muri QUIK
Hariho inzira 3 zizwi:
- Idosiye iyo ari yo yose yarakozwe, aho umugereka wa .lua ugomba gushyirwa. Ibikurikira, ugomba gufungura umwanditsi hanyuma ukandika kode. Nyuma yo gutangira, algorithm nkiyi izakorwa rimwe gusa. Urashobora kuyikoresha intoki igihe kitazwi. Urashobora kuyikoresha mugihe kimwe cyo kubara amakuru amwe.
- Mu nyandiko ya Lua ubwayo, ugomba gukora imikorere yitwa nyamukuru () . Byongeye, mumikorere imwe, ugomba gushyiramo kode yanditse. Kandi ibitotsi () imikorere ningirakamaro guhagarika by’agateganyo inyandiko cyangwa, kurundi ruhande, kuyisubiramo. Nukuvuga, niba ukora ibikorwa byingenzi (), hanyuma ugashyiramo imikorere yo gusinzira (), uzashobora kugera kubara hamwe numurongo wigihe runaka.
- Muri gahunda ya QLUA, urashobora gukoresha ibyabaye-bigezweho byiterambere. Kubwibyo, ubu ntabwo ari ngombwa “kumenya” impinduka mumikorere imwe kandi, kubwibi, kora amategeko akurikira.
Birasabwa gusesengura uburyo bwa nyuma muburyo burambuye. Kugirango ukemure ikintu cyihariye, ugomba kwandika imikorere mumyandikire yihuse. Urashobora gukoresha gahunda ikurikira: Inyandiko
ya LUA irashobora kuba igizwe nimirimo myinshi ifite amazina yihariye: amasezerano, amagambo, nibindi. Ugomba gushaka igice “Imbonerahamwe” muri gahunda, jya kuri “Lua”. Agasanduku k’ibiganiro kagaragara hariya kandi umurongo “Biboneka Inyandiko” bizagaragara, kanda kuriyo. Ibikurikira, kanda ahanditse “Gutangiza”. Noneho haza gutunganya no gushyira mubikorwa inshingano
nyamukuru () . Hanyuma, ugomba gutangaza
is_run , imikorere izaba irimo agaciro
kwukurikugeza igihe umukoresha akora buto yo guhagarika inyandiko. Noneho imikorere ihinduka ijya muburyo butari bwo imbere OnStop (). Nyuma yibyo, imikorere nyamukuru () irangira, kandi inyandiko ubwayo irahagarara. Inyandiko yanditse igomba gukizwa no gukora. Mugihe ukora transaction, uyikoresha azabona amakuru kuri buri kintu hamwe numubare wanyuma wubucuruzi.
Gukoresha QLua Byihuse, ugomba kuyimurira mububiko bushya kuri PC yawe. Urashobora kuyita icyo ushaka cyose, kurugero, “MyLua”. Inyandiko zose za Lua zizabikwa aho. Umaze kwinjira muri QUIK, ugomba gufungura igice cya “Serivisi”, hanyuma ukande ahanditse “Lua scripts”. Mu idirishya rifungura, kora buto “Ongera”. Noneho ugomba guhitamo inyandiko hanyuma ukingura. Bizaba mu gice cya “Gukuramo inyandiko”. Noneho ugomba kwerekana umurongo wimyandikire hanyuma ukande “Kwiruka”. Guhagarika inyandiko, kanda “Hagarara”.
Bot ya Quik kuri LUA [/ caption]
Nigute ushobora gushiraho inyandiko ya LUA mubucuruzi bwubucuruzi
Amahugurwa hamwe nibisanzwe bisaba algorithm imwe yo gushiraho robot yubucuruzi:
- Birakenewe gukanda kumurongo “Serivisi” murwego rwo hejuru rwa terminal.
- Ibikurikira, shakisha buto ya “LUA inyandiko” mumasanduku yamanutse hanyuma ukande:
- Icyo gihe, idirishya rya “Biboneka Inyandiko” rigomba kugaragara. Noneho, ugomba gukora buto ya “Ongeraho” hanyuma ugahitamo dosiye ya robo yubucuruzi isabwa.
Gufata amakuru kuva ku mbonerahamwe ya Lua hamwe ninyandiko muri Quik terminal: https://youtu.be/XVCZAnWoA8E Lua nuburyo bwiza bwo kwiga programming no gutsinda mugihe kizaza. Ikintu nyamukuru ntabwo ari uguhagarika gusa gusoma igitekerezo. Nibyiza kwiga ibikoresho uhora witoza. Nyuma yigihe runaka, uwatezimbere azatangira gutera imbere kandi abashe gukora ibicuruzwa bye bifite agaciro.