E D R S I H C RSS
ID
Password
Join
์ฐพ์•„๊ฐˆ ์–ด๋จธ๋‹ˆ๊ฐ€ ์žˆ๋Š” ํ•œ, ๊ฒฐ์ฝ” ์™„์ „ํ•œ ์–ด๋ฅธ์ด ๋˜์ง€ ๋ชปํ•œ๋‹ค. โ€•์‚ฌ๋ผ O.์ฃผ์ดํŠธ

๏ปฟ * ์›๋ฌธ๋งํฌ : [http]http://lua-users.org/wiki/LauxLibDocumentation

Contents

1 ๊ฐœ์š”
2 ๋ฃจ์•„ ์ฝ”๋“œ์˜ ๋กœ๋”ฉ ๋ฐ ์‹คํ–‰
2.1 luaL_loadfile(L,filename)
2.2 luaL_loadbuffer(L,b,n,name)
2.3 lua_dofile(L,filename)
2.4 lua_dobuffer(L,filename)
2.5 lua_dostring(L,filename)
3 ๋ฃจ์•„ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์—ด๊ธฐ
3.1 luaL_openlib(L,M,R,n)
4 ๋งค๊ฐœ๋ณ€์ˆ˜ ๊ฒ€์‚ฌ
4.1 luaL_checklstring(L,n,&l)
4.2 luaL_optlstring(L,n,s,&l)
4.3 luaL_checknumber and luaL_optnumber
4.4 luaL_checkany(L,n)
4.5 luaL_checktype(L,n,t)
4.6 luaL_checkstack(L,n,message)
4.7 luaL_typerror(L,n,t)
4.8 luaL_argerror(L,n,message)
4.9 luaL_argcheck(L,cond,n,message)
5 ์ธ์œ„์ ์ธ ์˜ค๋ฅ˜๋ฐœ์ƒ
5.1 luaL_error(L,fmt,...)
5.2 luaL_where(L,n)
6 ๋ฆฌ์ŠคํŠธ๋‚ด์—์„œ ๋ฌธ์ž์—ด์„ ์ฐพ์•„๋‚ด๊ธฐ
6.1 luaL_findstring(s,S)
7 ๋ฐฐ์—ด๋กœ์„œ ์‚ฌ์šฉ๋  ๋•Œ ํ…Œ์ด๋ธ”์˜ ๊ธธ์ด๋ฅผ ๊ด€๋ฆฌํ•˜๊ธฐ
7.1 luaL_getn(L,t)
7.2 luaL_setn(L,t,n)
8 ๋ฃจ์•„ ๊ฐ’์— ๋Œ€ํ•œ ์ฐธ์กฐ๋ฅผ ๊ด€๋ฆฌํ•˜๊ธฐ
8.1 luaL_ref(L,t)
8.2 luaL_unref(L,t,r)
9 "ํƒ€์ž…" userdata ๊ด€๋ฆฌํ•˜๊ธฐ
9.1 luaL_newmetatable(L,name)
9.2 luaL_getmetatable(L,name)
9.3 luaL_checkudata(L,n,name)
10 ๋ฉ”ํƒ€ ๋ฉ”์†Œ๋“œ ๊ด€๋ฆฌ
10.1 luaL_getmetafield(L,n,e)
10.2 luaL_callmeta(L,n,e)
11 ๋ฌธ์ž์—ด ๋ฒ„ํผ ๊ด€๋ฆฌ
11.1 luaL_buffinit(L,B)
11.2 luaL_prepbuffer(B)
11.3 luaL_putchar(B,c)
11.4 luaL_addsize(B,n)
11.5 luaL_addlstring(B,s,l)
11.6 luaL_addstring(B,s)
11.7 luaL_addvalue(B)
11.8 luaL_pushresult(B)

1 ๊ฐœ์š” #

์•„๋ž˜๋Š” ๋ฃจ์•„ ๋ณด์กฐ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ(lauxlib) API์— ๋Œ€ํ•œ ๋ช‡๋ช‡ ๊ฐ„๋‹จํ•œ ๋‚ด์šฉ์„ ๋‹ด๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฌธ์„œ๋‚ด์šฉ์€ ๋ฃจ์•„ ๋ ˆํผ๋Ÿฐ์Šค ๋ฉ”๋‰ด์–ผ์ฒ˜๋Ÿผ ๊ฐ„๊ฒฐํ•˜๊ฒŒ ๊ธฐ์ˆ ํ–ˆ์Šต๋‹ˆ๋‹ค.

2 ๋ฃจ์•„ ์ฝ”๋“œ์˜ ๋กœ๋”ฉ ๋ฐ ์‹คํ–‰ #


2.1 luaL_loadfile(L,filename) #

ํ™”์ผ์„ ๋‹ค๋ฃจ๋„๋ก ์ˆ˜์ •๋œ lua_load์˜ wrapper ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค. ๋‹ค๋ฅธ API์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด stack์— ๋„ฃ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

2.2 luaL_loadbuffer(L,b,n,name) #

๋ฒ„ํผ์—์„œ ์ฝ์–ด๋“ค์ด๋„๋ก ์ˆ˜์ •๋œ lua_load์˜ wrapper ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

2.3 lua_dofile(L,filename) #

ํ™”์ผ์„ ์ฝ์–ด๋“ค์—ฌ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค๋ฅธ API์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด stack์— ๋„ฃ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

2.4 lua_dobuffer(L,filename) #

๋ฒ„ํผ์„ ์ฝ์–ด๋“ค์—ฌ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค๋ฅธ API์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด stack์— ๋„ฃ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

2.5 lua_dostring(L,filename) #

๋ฌธ์ž์—ด์„ ์ฝ์–ด๋“ค์—ฌ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค๋ฅธ API์™€ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด stack์— ๋„ฃ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

3 ๋ฃจ์•„ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์—ด๊ธฐ #


3.1 luaL_openlib(L,M,R,n) #

Opens a Lua library into a global tabled named M. It registers the functions listed in the array R of pairs <name,function>. Each function gets n upvalues, which are the n top values on the stack. Each function gets the same n upvalue s. If M exists it is used. Otherwise, a new table named M is created and used.

4 ๋งค๊ฐœ๋ณ€์ˆ˜ ๊ฒ€์‚ฌ #


4.1 luaL_checklstring(L,n,&l) #

์Šคํƒ ์œ„์น˜ n์— ๋†“์ธ ๊ฐ’์ด ๋ฌธ์ž์—ด์ธ์ง€๋ฅผ ๊ฒ€์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๋งŒ์ผ ๊ทธ๋ ‡๋‹ค๋ฉด, ๋ฌธ์ž์—ด ํฌ์ธํ„ฐ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ณ  ๊ทธ ๊ธธ์ด๋ฅผ l์— ๋„ฃ์Šต๋‹ˆ๋‹ค. (์ด๋•Œ l์€ NULL์ด ์•„๋‹ˆ์–ด์•ผํ•ฉ๋‹ˆ๋‹ค) ๊ฐ’์ด ๋ฌธ์ž์—ด์ด ์•„๋‹ˆ๋ฉด, ์˜ค๋ฅ˜๋ฅผ ์ผ์œผํ‚ต๋‹ˆ๋‹ค. l์„ ๊ด€๋ฆฌํ•˜๊ธฐ๊ฐ€ ์ข€ ๊ทธ๋ ‡๋‹ค๋ฉด, ๋Œ€์‹  luaL_checkstring(L,n)์„ ์‚ฌ์šฉํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

4.2 luaL_optlstring(L,n,s,&l) #

Similar to luaL_checklstring, except that is argument n is absent then s is used as a default value and returned. If you don't care about l, use luaL_optstring(L,n,s) instead.

4.3 luaL_checknumber and luaL_optnumber #

luaL_checknumber and luaL_optnumber do the same thing for numbers. luaL_checkint, luaL_optint, luaL_checklong, and luaL_optlong work on top of luaL_checknumber and luaL_optnumber and return int and long.

4.4 luaL_checkany(L,n) #

๋งค๊ฐœ๋ณ€์ˆ˜ n์ด ์กด์žฌํ•˜๋Š”์ง€ ๊ฒ€์‚ฌํ•˜๊ณ  ๊ทธ๋ ‡์ง€ ์•Š์œผ๋ฉด ์˜ค๋ฅ˜๋ฅผ ์ผ์œผํ‚ต๋‹ˆ๋‹ค. (Checks that argument n is present, issuing an error if not.)

4.5 luaL_checktype(L,n,t) #

๋งค๊ฐœ๋ณ€์ˆ˜ n์ด ํƒ€์ž… t (LUA_T*)์ธ์ง€ ๊ฒ€์‚ฌํ•˜๊ณ , ํ•ด๋‹น ํƒ€์ž…์ด ์•„๋‹ˆ๋ฉด ์˜ค๋ฅ˜๋ฅผ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

4.6 luaL_checkstack(L,n,message) #

์‹คํŒจํ•  ๊ฒฝ์šฐ message์— ํ•ด๋‹นํ•˜๋Š” ์˜ค๋ฅ˜๋ฅผ ๋ฐœ์ƒํ•˜๋„๋ก ํ•œ lua_checkstack()์˜ wrapper ๋ฒ„์ „์ž…๋‹ˆ๋‹ค.

4.7 luaL_typerror(L,n,t) #

Issues an type error about argument n, whose type was expected to be t (a string, not a LUA_T*). A workhorse function for the functions above, but also useful in itself.

4.8 luaL_argerror(L,n,message) #

Issues an error about argument n. If message is not NULL, it is appended to the error message. This is the real workhorse function for previous functions, but it is also useful in itself.

4.9 luaL_argcheck(L,cond,n,message) #

If cond is false, call luaL_argerror(L,n,message).

5 ์ธ์œ„์ ์ธ ์˜ค๋ฅ˜๋ฐœ์ƒ #


5.1 luaL_error(L,fmt,...) #

Issues an error whose message is formatted using a printf-like string fmt. It uses {{lua_pushfstring}} and so only handles `%d', `%c', %f, and `%s'.

5.2 luaL_where(L,n) #

Tries to display the error location if the function at level n is a Lua function.

6 ๋ฆฌ์ŠคํŠธ๋‚ด์—์„œ ๋ฌธ์ž์—ด์„ ์ฐพ์•„๋‚ด๊ธฐ #


6.1 luaL_findstring(s,S) #

๋ฌธ์ž์—ด ๋ฐฐ์—ด S์—์„œ ๋ฌธ์ž์—ด s๋ฅผ ๊ฒ€์‚ฌํ•ฉ๋‹ˆ๋‹ค. ๋ฐœ๊ฒฌํ•˜๋ฉด ํ•ด๋‹น ์ธ๋ฑ์Šค๋ฅผ, ์•„๋‹ˆ๋ฉด -1์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ ์„ ํ˜• ๊ฒ€์ƒ‰์„ ์ˆ˜ํ–‰ํ•˜์—ฌ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. ๋ฐฐ์—ด S๋Š” ๋ฐ˜๋“œ์‹œ NULL ๋ฌธ์ž์—ด๋กœ ์ข…๋ฃŒํ•ด์•ผ๋งŒํ•ฉ๋‹ˆ๋‹ค.

7 ๋ฐฐ์—ด๋กœ์„œ ์‚ฌ์šฉ๋  ๋•Œ ํ…Œ์ด๋ธ”์˜ ๊ธธ์ด๋ฅผ ๊ด€๋ฆฌํ•˜๊ธฐ #


7.1 luaL_getn(L,t) #

์Šคํƒ์œ„์น˜ t์— ์œ„์น˜ํ•œ ํ…Œ์ด๋ธ”์˜ ํฌ๊ธฐ๋ฅผ ์–ป์–ด๋ƒ…๋‹ˆ๋‹ค.

7.2 luaL_setn(L,t,n) #

์Šคํƒ์œ„์น˜ t์— ์œ„์น˜ํ•œ ํ…Œ์ด๋ธ”์˜ ํฌ๊ธฐ๋ฅผ n์œผ๋กœ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

8 ๋ฃจ์•„ ๊ฐ’์— ๋Œ€ํ•œ ์ฐธ์กฐ๋ฅผ ๊ด€๋ฆฌํ•˜๊ธฐ #


8.1 luaL_ref(L,t) #

์Šคํƒ์˜ ๊ฐ€์žฅ ๊ผญ๋Œ€๊ธฐ(top)์— ์œ„์น˜ํ•œ ๊ฐ’์˜ ์ฐธ์กฐ๋ฅผ ์Šคํƒ์œ„์น˜ t์— ์œ„์น˜ํ•œ ํ…Œ์ด๋ธ”์— ๋„ฃ์Šต๋‹ˆ๋‹ค.

8.2 luaL_unref(L,t,r) #

์Šคํƒ์œ„์น˜ t์— ์œ„์น˜ํ•œ ํ…Œ์ด๋ธ”์—์„œ ์ฐธ์กฐ r์„ ์ œ๊ฑฐํ•ฉ๋‹ˆ๋‹ค.

9 "ํƒ€์ž…" userdata ๊ด€๋ฆฌํ•˜๊ธฐ #


9.1 luaL_newmetatable(L,name) #

Create a metatable for representing the named "type".

9.2 luaL_getmetatable(L,name) #

Get the metatable representing the named "type".

9.3 luaL_checkudata(L,n,name) #

Checks whether the value at stack position is userdata of the named type. If not, returns NULL (even if the value is not userdata).

10 ๋ฉ”ํƒ€ ๋ฉ”์†Œ๋“œ ๊ด€๋ฆฌ #


10.1 luaL_getmetafield(L,n,e) #

Gets the metamethod corresponding to event e in the metatable of the value at position n.

10.2 luaL_callmeta(L,n,e) #

Calls the metamethod corresponding to event e for the value at position n.

11 ๋ฌธ์ž์—ด ๋ฒ„ํผ ๊ด€๋ฆฌ #

  • lauxlib์€ ๋ฌธ์ž์—ด ๋ฒ„ํผ๋“ค์„ ์œ ์ง€ํ•˜๊ธฐ์œ„ํ•œ ํ•จ์ˆ˜๋“ค์„ ๋‹ด๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. Very handy for creating arbitrarily long string in a piecewise way in a efficient way (not the obvious quadratic algorithm). ์˜ˆ์ œ๋ฅผ ์œ„ํ•ด lstrlib.c๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.The functions in this set could have better names...

11.1 luaL_buffinit(L,B) #

๋ฒ„ํผ๋ฅผ ์ดˆ๊ธฐํ™”ํ•ฉ๋‹ˆ๋‹ค. ๋ฒ„ํผ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ์ „์— ๋ฐ˜๋“œ์‹œ ํ˜ธ์ถœํ•ด์•ผ๋งŒ ํ•ฉ๋‹ˆ๋‹ค. B๋Š” luaL_Buffer ํƒ€์ž…์˜ ์ž๋™๋ณ€์ˆ˜(์ง€์—ญ๋ณ€์ˆ˜)์˜ ์ฃผ์†Œ๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.

11.2 luaL_prepbuffer(B) #

์žฌ์‚ฌ์šฉ์„ ์œ„ํ•ด ์Šคํƒ์ƒ์— B์˜ ํ˜„์žฌ ๊ฐ’์„ ๋‚จ๊ฒจ๋‘๊ณ  ๊ทธ ๋‚ด์šฉ๋งŒ ๋น„์›๋‹ˆ๋‹ค.

11.3 luaL_putchar(B,c) #

B์— ๋ฌธ์ž ํ•˜๋‚˜๋ฅผ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

11.4 luaL_addsize(B,n) #

B์— n ํฌ๊ธฐ๋งŒํผ ๊ธธ์ด๋ฅผ ๋Š˜๋ฆฝ๋‹ˆ๋‹ค.

11.5 luaL_addlstring(B,s,l) #

B์— l๊ธธ์ด๋งŒํผ ๋ฌธ์ž์—ด s๋ฅผ ๋ง๋ถ™์ž…๋‹ˆ๋‹ค.

11.6 luaL_addstring(B,s) #

B์— ๋ฌธ์ž์—ด s๋ฅผ ๋ง๋ถ™์ž…๋‹ˆ๋‹ค. ๋ฌธ์ž์—ด s๋Š” ๋ฐ˜๋“œ์‹œ ๋„๋ฌธ์ž('\0')๋กœ ๋๋‚˜์•ผํ•ฉ๋‹ˆ๋‹ค.

11.7 luaL_addvalue(B) #

B์— ์Šคํƒ ์ตœ์ƒ๋‹จ์˜ ๊ฐ’์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ์ถ”๊ฐ€ํ•˜๊ธฐ์ „์— ์ž๋™์œผ๋กœ lua_tostring์œผ๋กœ ๊ฐ’์„ ๋ฌธ์ž์—ด๋กœ ๋ณ€ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

11.8 luaL_pushresult(B) #

์Šคํƒ ์ตœ์ƒ๋‹จ์— ๋ฒ„ํผ์— ์ „์ฒด ๋‚ด์šฉ์„ ๋„ฃ์Šต๋‹ˆ๋‹ค. ์ผ๋ฐ˜์ ์œผ๋กœ ๋ฃจ์•„์— ๋“ฑ๋ก๋˜๋ฉฐ, ๋‚ด๋ถ€์ ์œผ๋กœ ๋ฒ„ํผ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ํ•จ์ˆ˜ ์ฝ”๋“œ ๊ฐ€์žฅ ๋งˆ์ง€๋ง‰์— ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2010-10-28 12:42:52
Processing time 0.5670 sec