ଲୁଆ (ପ୍ରୋଗ୍ରାମିଂ ଭାଷା)
ଛାଞ୍ଚ:Infobox programming language
ଲୁଆ (ଛାଞ୍ଚ:IPAc-en ଛାଞ୍ଚ:Respell, from ଛାଞ୍ଚ:Lang-pt ଛାଞ୍ଚ:IPA-pt meaning moon; explicitly not "LUA"[୧]) ଏକ lightweight ପ୍ରୋଗ୍ରାମିଂ ଭାଷା ଅଟେ । ଏହା ANSI Cରେ ଲେଖା ହୋଇଥିବାରୁ ବିଭିନ୍ନ ପ୍ରକାରର କମ୍ପ୍ୟୁଟରରେ ଚାଲିପାରେ ଏଣୁ ଏହାକୁ Cross-platform ସ୍କ୍ରିପ୍ଟ ଭାଷା କୁହାଯାଇପାରେ । [୧] ଲୁଆର ଆପ୍ଲିକେସନ ପ୍ରୋଗ୍ରାମିଂ ଇଣ୍ଟରଫେସ ବା API ସି ଅପେକ୍ଷା ସରଳ ଅଟେ ।[୨]
ଇତିହାସ
ଫିଚର
କିଛି କୋଡ ଉଦାହରଣ
ଏକ ପାରମ୍ପରିକ ହେଲୋ ୱାଲ୍ଡ ପ୍ରୋଗ୍ରାମ ନିମ୍ନୋକ୍ତ ପ୍ରକାରରେ ଲେଖା ଯାଇପାରିବ:
print('Hello World!')
ମନ୍ତବ୍ୟଗୁଡ଼ିକ ନିମ୍ନଲିଖିତ ସିଣ୍ଟାକ୍ସ ବ୍ୟବହାର କରନ୍ତି ଓ ସେସବୁ ଆଡ଼ା, ଇଫେଲ, ହାସକେଲ, SQL ଏବଂ VHDL ଆଦି ସହ ସମାନ:
-- A comment in Lua starts with a double-hyphen and runs to the end of the line.
--[[ Multi-line strings & comments
are adorned with double square brackets. ]]
--[=[ Comments like this can have other --[[comments]] nested. ]=]
ଫାକ୍ଟୋରିଆଲ ଫଳନ ଏହି ଉଦାହରଣରେ ଥିବା ଗୋଟିଏ ଫଳନ ଭାବେ କାର୍ଯ୍ୟକାରୀ ହୋଇଛି:
function factorial(n)
local x = 1
for i = 2,n do
x = x * i
end
return x
end
ଲୁପ୍
ଲୁଆ ଚାରି ପ୍ରକାରର ଲୁପ ବ୍ୟବହାର କରିଥାଏ: ହ୍ୱାଇଲ ଲୁପ, ରିପିଟ ଲୁପ (ଏକ ଡୁ ହ୍ୱାଇଲ ଲୁପ ସହ ସମାନ), ଫର ଲୁପ, ଏବଂ ସାଧାରଣ ଫର ଲୁପ ।
--condition = true
while condition do
--statements
end
repeat
--statements
until condition
for i = first,last,delta do --delta may be negative, allowing the for loop to count down or up
print(i)
end
ସାଧାରଣ ଫର ଲୁପ:
for key, value in pairs(_G) do
print(key, value)
end
ଏହା _G ସାଧାରଣ ଆଇଟିରେଟର ଫଙ୍କସନ pairs ବ୍ୟବହାର କରି ଟେବୁଲ ଉପରେ ପ୍ରକାଶ କରିବ (nil ମିଳିବା ଯାଏ) ।
ଫଙ୍କସନଗୁଡ଼ିକ
ଟେବୁଲ
ରେକର୍ଡ଼ ଭାବେ
ନେମସ୍ପେସ ଭାବେ
ଆରେ ଭାବେ
ମେଟାଟେବୁଲ
ଅବଜେକ୍ଟ-ଆଧାରିତ ପ୍ରୋଗ୍ରାମିଂ
ସି ଆପ୍ଲିକେସନ ପ୍ରୋଗ୍ରାମିଂ ଇଣ୍ଟରଫେସ
ଲୂଆ ଫଙ୍କ୍ସନ୍କୁ ସି ପ୍ରୋଗ୍ରାମିଂ ଭାଷା ବ୍ୟବହାର କରି କିପରି କଲ୍ କରିହେବ ତାହାର ଏକ ଛୋଟ ଉଦାହରଣ:
#include <stdio.h>
#include <stdlib.h>
#include <lua.h>
#include <lauxlib.h>
int main(void)
{
lua_State *L = luaL_newstate();
if (luaL_dostring(L, "function foo (x,y) return x+y end")) {
lua_close(L);
exit(EXIT_FAILURE);
}
lua_getglobal(L, "foo");
lua_pushinteger(L, 5);
lua_pushinteger(L, 3);
lua_call(L, 2, 1);
printf("Result: %d\n", lua_tointeger(L, -1));
lua_close(L);
return 0;
}
Running this example gives:
$ gcc -o example example.c -llua $ ./example Result: 8
ବ୍ୟବହାର
- ଭିଡିଓ ଗେମ ପ୍ରସ୍ତୁତକାରୀମାନଙ୍କ ପାଇଁ ଏହା ବିପୁଳ ମାତ୍ରାରେ ଆଦୃତ ସ୍କ୍ରିପ୍ଟ ଭାଷା ଅଟେ ।
ଆହୁରି ଦେଖନ୍ତୁ
ଆଧାର
ଆହୁରି ପଢନ୍ତୁ
ବହି
- ଛାଞ୍ଚ:Cite book
- ଛାଞ୍ଚ:Cite book
- ଛାଞ୍ଚ:Cite book
- ଛାଞ୍ଚ:Cite book
- ଛାଞ୍ଚ:Cite book Chapters 6 and 7 are dedicated to Lua, while others look at software in Brazil more broadly.
- ଛାଞ୍ଚ:Cite book
- ଛାଞ୍ଚ:Cite book (The 1st ed. is available online.)
ପ୍ରବନ୍ଧ
- ଛାଞ୍ଚ:Cite web
- ଛାଞ୍ଚ:Cite web
- ଛାଞ୍ଚ:Cite web
- ଛାଞ୍ଚ:Cite journal
- ଛାଞ୍ଚ:Cite news Interview with Roberto Ierusalimschy.
- ଛାଞ୍ଚ:Cite journal How the embeddability of Lua impacted its design.
- Lua papers and theses
ବାହାର ଲିଙ୍କ
ଛାଞ୍ଚ:Commons category ଛାଞ୍ଚ:Wikibooks ଛାଞ୍ଚ:Wikiversity ଛାଞ୍ଚ:MediaWiki
- ଛାଞ୍ଚ:Official website
- lua-users.org ଛାଞ୍ଚ:Webarchive – Community website for and by users (and authors) of Lua
- eLua – Embedded Lua
- Projects in Lua
- SquiLu Squirrel modified with Lua libraries