| @@ -18,7 +18,7 @@ Lua 5.1 Reference Manual · 17 unmodified lines |
| 18 | by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes | 18 | by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes |
| 19 | <p> | 19 | <p> |
| 20 | <small> | 20 | <small> |
| 21 | Copyright © 2006-2007 Lua.org, PUC-Rio. | 21 | Copyright © 2006-2008 Lua.org, PUC-Rio. |
| 22 | Freely available under the terms of the | 22 | Freely available under the terms of the |
| 23 | <a href="http://www.lua.org/license.html#5">Lua license</a>. | 23 | <a href="http://www.lua.org/license.html#5">Lua license</a>. |
| 24 | </small> | 24 | </small> |
| @@ -32,6 +32,7 @@ Freely available under the terms of the · 7 unmodified lines |
| 32 | <!-- ====================================================================== --> | 32 | <!-- ====================================================================== --> |
| 33 | <p> | 33 | <p> |
| 34 | | 34 | |
| | 35 | <!-- $Id: manual.of,v 1.43 2008/01/17 16:19:44 roberto Exp $ --> |
| 35 | | 36 | |
| 36 | | 37 | |
| 37 | | 38 | |
| @@ -554,9 +555,9 @@ and a list of expressions on the right side. · 516 unmodified lines |
| 554 | The elements in both lists are separated by commas: | 555 | The elements in both lists are separated by commas: |
| 555 | | 556 | |
| 556 | <pre> | 557 | <pre> |
| 557 | stat ::= varlist1 `<b>=</b>´ explist1 | 558 | stat ::= varlist `<b>=</b>´ explist |
| 558 | varlist1 ::= var {`<b>,</b>´ var} | 559 | varlist ::= var {`<b>,</b>´ var} |
| 559 | explist1 ::= exp {`<b>,</b>´ exp} | 560 | explist ::= exp {`<b>,</b>´ exp} |
| 560 | </pre><p> | 561 | </pre><p> |
| 561 | Expressions are discussed in <a href="#2.5">§2.5</a>. | 562 | Expressions are discussed in <a href="#2.5">§2.5</a>. |
| 562 | | 563 | |
| @@ -663,7 +664,7 @@ Functions and chunks may return more than one value, · 100 unmodified lines |
| 663 | so the syntax for the <b>return</b> statement is | 664 | so the syntax for the <b>return</b> statement is |
| 664 | | 665 | |
| 665 | <pre> | 666 | <pre> |
| 666 | stat ::= <b>return</b> [explist1] | 667 | stat ::= <b>return</b> [explist] |
| 667 | </pre> | 668 | </pre> |
| 668 | | 669 | |
| 669 | <p> | 670 | <p> |
| @@ -771,7 +772,7 @@ stopping when this new value is <b>nil</b>. · 101 unmodified lines |
| 771 | The generic <b>for</b> loop has the following syntax: | 772 | The generic <b>for</b> loop has the following syntax: |
| 772 | | 773 | |
| 773 | <pre> | 774 | <pre> |
| 774 | stat ::= <b>for</b> namelist <b>in</b> explist1 <b>do</b> block <b>end</b> | 775 | stat ::= <b>for</b> namelist <b>in</b> explist <b>do</b> block <b>end</b> |
| 775 | namelist ::= Name {`<b>,</b>´ Name} | 776 | namelist ::= Name {`<b>,</b>´ Name} |
| 776 | </pre><p> | 777 | </pre><p> |
| 777 | A <b>for</b> statement like | 778 | A <b>for</b> statement like |
| @@ -843,7 +844,7 @@ Local variables may be declared anywhere inside a block. · 65 unmodified lines |
| 843 | The declaration may include an initial assignment: | 844 | The declaration may include an initial assignment: |
| 844 | | 845 | |
| 845 | <pre> | 846 | <pre> |
| 846 | stat ::= <b>local</b> namelist [`<b>=</b>´ explist1] | 847 | stat ::= <b>local</b> namelist [`<b>=</b>´ explist] |
| 847 | </pre><p> | 848 | </pre><p> |
| 848 | If present, an initial assignment has the same semantics | 849 | If present, an initial assignment has the same semantics |
| 849 | of a multiple assignment (see <a href="#2.4.3">§2.4.3</a>). | 850 | of a multiple assignment (see <a href="#2.4.3">§2.4.3</a>). |
| @@ -1221,7 +1222,7 @@ except that <code>v</code> is evaluated only once. · 371 unmodified lines |
| 1221 | Arguments have the following syntax: | 1222 | Arguments have the following syntax: |
| 1222 | | 1223 | |
| 1223 | <pre> | 1224 | <pre> |
| 1224 | args ::= `<b>(</b>´ [explist1] `<b>)</b>´ | 1225 | args ::= `<b>(</b>´ [explist] `<b>)</b>´ |
| 1225 | args ::= tableconstructor | 1226 | args ::= tableconstructor |
| 1226 | args ::= String | 1227 | args ::= String |
| 1227 | </pre><p> | 1228 | </pre><p> |
| @@ -1286,7 +1287,7 @@ The syntax for function definition is · 58 unmodified lines |
| 1286 | | 1287 | |
| 1287 | <pre> | 1288 | <pre> |
| 1288 | function ::= <b>function</b> funcbody | 1289 | function ::= <b>function</b> funcbody |
| 1289 | funcbody ::= `<b>(</b>´ [parlist1] `<b>)</b>´ block <b>end</b> | 1290 | funcbody ::= `<b>(</b>´ [parlist] `<b>)</b>´ block <b>end</b> |
| 1290 | </pre> | 1291 | </pre> |
| 1291 | | 1292 | |
| 1292 | <p> | 1293 | <p> |
| @@ -1355,7 +1356,7 @@ Parameters act as local variables that are · 62 unmodified lines |
| 1355 | initialized with the argument values: | 1356 | initialized with the argument values: |
| 1356 | | 1357 | |
| 1357 | <pre> | 1358 | <pre> |
| 1358 | parlist1 ::= namelist [`<b>,</b>´ `<b>...</b>´] | `<b>...</b>´ | 1359 | parlist ::= namelist [`<b>,</b>´ `<b>...</b>´] | `<b>...</b>´ |
| 1359 | </pre><p> | 1360 | </pre><p> |
| 1360 | When a function is called, | 1361 | When a function is called, |
| 1361 | the list of arguments is adjusted to | 1362 | the list of arguments is adjusted to |
| @@ -1551,11 +1552,11 @@ you must use the C API for that. · 189 unmodified lines |
| 1551 | | 1552 | |
| 1552 | | 1553 | |
| 1553 | <p> | 1554 | <p> |
| 1554 | Tables and userdata have individual metatables | 1555 | Tables and full userdata have individual metatables |
| 1555 | (although multiple tables and userdata can share their metatables); | 1556 | (although multiple tables and userdata can share their metatables); |
| 1556 | values of all other types share one single metatable per type. | 1557 | values of all other types share one single metatable per type. |
| 1557 | So, there is one single metatable for all numbers, | 1558 | So, there is one single metatable for all numbers, |
| 1558 | and for all strings, etc. | 1559 | one for all strings, etc. |
| 1559 | | 1560 | |
| 1560 | | 1561 | |
| 1561 | <p> | 1562 | <p> |
| @@ -1638,7 +1639,7 @@ the behavior of the <code>op1 + op2</code> is · 76 unmodified lines |
| 1638 | local h = getbinhandler(op1, op2, "__add") | 1639 | local h = getbinhandler(op1, op2, "__add") |
| 1639 | if h then | 1640 | if h then |
| 1640 | -- call the handler with both operands | 1641 | -- call the handler with both operands |
| 1641 | return h(op1, op2) | 1642 | return (h(op1, op2)) |
| 1642 | else -- no handler available: default behavior | 1643 | else -- no handler available: default behavior |
| 1643 | error(···) | 1644 | error(···) |
| 1644 | end | 1645 | end |
| @@ -1695,7 +1696,7 @@ the unary <code>-</code> operation. · 50 unmodified lines |
| 1695 | local h = metatable(op).__unm | 1696 | local h = metatable(op).__unm |
| 1696 | if h then | 1697 | if h then |
| 1697 | -- call the handler with the operand | 1698 | -- call the handler with the operand |
| 1698 | return h(op) | 1699 | return (h(op)) |
| 1699 | else -- no handler available: default behavior | 1700 | else -- no handler available: default behavior |
| 1700 | error(···) | 1701 | error(···) |
| 1701 | end | 1702 | end |
| @@ -1716,7 +1717,7 @@ the <code>..</code> (concatenation) operation. · 14 unmodified lines |
| 1716 | else | 1717 | else |
| 1717 | local h = getbinhandler(op1, op2, "__concat") | 1718 | local h = getbinhandler(op1, op2, "__concat") |
| 1718 | if h then | 1719 | if h then |
| 1719 | return h(op1, op2) | 1720 | return (h(op1, op2)) |
| 1720 | else | 1721 | else |
| 1721 | error(···) | 1722 | error(···) |
| 1722 | end | 1723 | end |
| @@ -1739,7 +1740,7 @@ the <code>#</code> operation. · 16 unmodified lines |
| 1739 | local h = metatable(op).__len | 1740 | local h = metatable(op).__len |
| 1740 | if h then | 1741 | if h then |
| 1741 | -- call the handler with the operand | 1742 | -- call the handler with the operand |
| 1742 | return h(op) | 1743 | return (h(op)) |
| 1743 | else -- no handler available: default behavior | 1744 | else -- no handler available: default behavior |
| 1744 | error(···) | 1745 | error(···) |
| 1745 | end | 1746 | end |
| @@ -1779,7 +1780,7 @@ The "eq" event is defined as follows: · 33 unmodified lines |
| 1779 | -- try metamethod | 1780 | -- try metamethod |
| 1780 | local h = getcomphandler(op1, op2, "__eq") | 1781 | local h = getcomphandler(op1, op2, "__eq") |
| 1781 | if h then | 1782 | if h then |
| 1782 | return h(op1, op2) | 1783 | return (h(op1, op2)) |
| 1783 | else | 1784 | else |
| 1784 | return false | 1785 | return false |
| 1785 | end | 1786 | end |
| @@ -1801,7 +1802,7 @@ the <code><</code> operation. · 15 unmodified lines |
| 1801 | else | 1802 | else |
| 1802 | local h = getcomphandler(op1, op2, "__lt") | 1803 | local h = getcomphandler(op1, op2, "__lt") |
| 1803 | if h then | 1804 | if h then |
| 1804 | return h(op1, op2) | 1805 | return (h(op1, op2)) |
| 1805 | else | 1806 | else |
| 1806 | error(···); | 1807 | error(···); |
| 1807 | end | 1808 | end |
| @@ -1824,7 +1825,7 @@ the <code><=</code> operation. · 16 unmodified lines |
| 1824 | else | 1825 | else |
| 1825 | local h = getcomphandler(op1, op2, "__le") | 1826 | local h = getcomphandler(op1, op2, "__le") |
| 1826 | if h then | 1827 | if h then |
| 1827 | return h(op1, op2) | 1828 | return (h(op1, op2)) |
| 1828 | else | 1829 | else |
| 1829 | h = getcomphandler(op1, op2, "__lt") | 1830 | h = getcomphandler(op1, op2, "__lt") |
| 1830 | if h then | 1831 | if h then |
| @@ -1861,8 +1862,8 @@ The indexing access <code>table[key]</code>. · 30 unmodified lines |
| 1861 | end | 1862 | end |
| 1862 | end | 1863 | end |
| 1863 | if type(h) == "function" then | 1864 | if type(h) == "function" then |
| 1864 | return h(table, key) -- call the handler | 1865 | return (h(table, key)) -- call the handler |
| 1865 | else return h[key] -- or repeat operation on it | 1866 | else return h[key] -- or repeat operation on it |
| 1866 | end | 1867 | end |
| 1867 | end | 1868 | end |
| 1868 | </pre><p> | 1869 | </pre><p> |
| @@ -1887,7 +1888,7 @@ The indexing assignment <code>table[key] = value</code>. · 18 unmodified lines |
| 1887 | end | 1888 | end |
| 1888 | end | 1889 | end |
| 1889 | if type(h) == "function" then | 1890 | if type(h) == "function" then |
| 1890 | return h(table, key,value) -- call the handler | 1891 | h(table, key,value) -- call the handler |
| 1891 | else h[key] = value -- or repeat operation on it | 1892 | else h[key] = value -- or repeat operation on it |
| 1892 | end | 1893 | end |
| 1893 | end | 1894 | end |
| @@ -2062,6 +2063,7 @@ order of their creation, · 168 unmodified lines |
| 2062 | among those collected in that cycle. | 2063 | among those collected in that cycle. |
| 2063 | That is, the first finalizer to be called is the one associated | 2064 | That is, the first finalizer to be called is the one associated |
| 2064 | with the userdata created last in the program. | 2065 | with the userdata created last in the program. |
| | 2066 | The userdata itself is freed only in the next garbage-collection cycle. |
| 2065 | | 2067 | |
| 2066 | | 2068 | |
| 2067 | | 2069 | |
| @@ -2427,17 +2429,14 @@ any error jumps to the most recent active recover point. · 359 unmodified lines |
| 2427 | | 2429 | |
| 2428 | | 2430 | |
| 2429 | <p> | 2431 | <p> |
| 2430 | Almost any function in the API may raise an error, | 2432 | Most functions in the API may throw an error, |
| 2431 | for instance due to a memory allocation error. | 2433 | for instance due to a memory allocation error. |
| 2432 | The following functions run in protected mode | 2434 | The documentation for each function indicates whether |
| 2433 | (that is, they create a protected environment to run), | 2435 | it can throw errors. |
| 2434 | so they never raise an error: | | |
| 2435 | <a href="#lua_newstate"><code>lua_newstate</code></a>, <a href="#lua_close"><code>lua_close</code></a>, <a href="#lua_load"><code>lua_load</code></a>, | | |
| 2436 | <a href="#lua_pcall"><code>lua_pcall</code></a>, and <a href="#lua_cpcall"><code>lua_cpcall</code></a>. | | |
| 2437 | | 2436 | |
| 2438 | | 2437 | |
| 2439 | <p> | 2438 | <p> |
| 2440 | Inside a C function you can raise an error by calling <a href="#lua_error"><code>lua_error</code></a>. | 2439 | Inside a C function you can throw an error by calling <a href="#lua_error"><code>lua_error</code></a>. |
| 2441 | | 2440 | |
| 2442 | | 2441 | |
| 2443 | | 2442 | |
| @@ -2448,6 +2447,30 @@ Inside a C function you can raise an error by calling <a href="#lua_error"> · 4 unmodified lines |
| 2448 | <p> | 2447 | <p> |
| 2449 | Here we list all functions and types from the C API in | 2448 | Here we list all functions and types from the C API in |
| 2450 | alphabetical order. | 2449 | alphabetical order. |
| | 2450 | Each function has an indicator like this: |
| | 2451 | <span class="apii">[-o, +p, <em>x</em>]</span> |
| | 2452 | |
| | 2453 | |
| | 2454 | <p> |
| | 2455 | The first field, <code>o</code>, |
| | 2456 | is how many elements the function pops from the stack. |
| | 2457 | The second field, <code>p</code>, |
| | 2458 | is how many elements the function pushes onto the stack. |
| | 2459 | (Any function always pushes its results after popping its arguments.) |
| | 2460 | A field in the form <code>x|y</code> means the function may push (or pop) |
| | 2461 | <code>x</code> or <code>y</code> elements, |
| | 2462 | depending on the situation; |
| | 2463 | an interrogation mark '<code>?</code>' means that |
| | 2464 | we cannot know how many elements the function pops/pushes |
| | 2465 | by looking only at its arguments |
| | 2466 | (e.g., they may depend on what is on the stack). |
| | 2467 | The third field, <code>x</code>, |
| | 2468 | tells whether the function may throw errors: |
| | 2469 | '<code>-</code>' means the function never throws any error; |
| | 2470 | '<code>m</code>' means the function may throw an error |
| | 2471 | only due to not enough memory; |
| | 2472 | '<code>e</code>' means the function may throw other kinds of errors; |
| | 2473 | '<code>v</code>' means the function may throw an error on purpose. |
| 2451 | | 2474 | |
| 2452 | | 2475 | |
| 2453 | | 2476 | |
| @@ -2506,7 +2529,8 @@ ANSI C ensures both behaviors. · 52 unmodified lines |
| 2506 | | 2529 | |
| 2507 | | 2530 | |
| 2508 | | 2531 | |
| 2509 | <hr><h3><a name="lua_atpanic"><code>lua_atpanic</code></a></h3> | 2532 | <hr><h3><a name="lua_atpanic"><code>lua_atpanic</code></a></h3><p> |
| | 2533 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 2510 | <pre>lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);</pre> | 2534 | <pre>lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);</pre> |
| 2511 | | 2535 | |
| 2512 | <p> | 2536 | <p> |
| @@ -2529,7 +2553,8 @@ The panic function can access the error message at the top of the stack. · 16 unmodified lines |
| 2529 | | 2553 | |
| 2530 | | 2554 | |
| 2531 | | 2555 | |
| 2532 | <hr><h3><a name="lua_call"><code>lua_call</code></a></h3> | 2556 | <hr><h3><a name="lua_call"><code>lua_call</code></a></h3><p> |
| | 2557 | <span class="apii">[-(nargs + 1), +nresults, <em>e</em>]</span> |
| 2533 | <pre>void lua_call (lua_State *L, int nargs, int nresults);</pre> | 2558 | <pre>void lua_call (lua_State *L, int nargs, int nresults);</pre> |
| 2534 | | 2559 | |
| 2535 | <p> | 2560 | <p> |
| @@ -2639,7 +2664,8 @@ of numerical arguments and returns their average and sum: · 103 unmodified lines |
| 2639 | | 2664 | |
| 2640 | | 2665 | |
| 2641 | | 2666 | |
| 2642 | <hr><h3><a name="lua_checkstack"><code>lua_checkstack</code></a></h3> | 2667 | <hr><h3><a name="lua_checkstack"><code>lua_checkstack</code></a></h3><p> |
| | 2668 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 2643 | <pre>int lua_checkstack (lua_State *L, int extra);</pre> | 2669 | <pre>int lua_checkstack (lua_State *L, int extra);</pre> |
| 2644 | | 2670 | |
| 2645 | <p> | 2671 | <p> |
| @@ -2653,7 +2679,8 @@ it is left unchanged. · 7 unmodified lines |
| 2653 | | 2679 | |
| 2654 | | 2680 | |
| 2655 | | 2681 | |
| 2656 | <hr><h3><a name="lua_close"><code>lua_close</code></a></h3> | 2682 | <hr><h3><a name="lua_close"><code>lua_close</code></a></h3><p> |
| | 2683 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 2657 | <pre>void lua_close (lua_State *L);</pre> | 2684 | <pre>void lua_close (lua_State *L);</pre> |
| 2658 | | 2685 | |
| 2659 | <p> | 2686 | <p> |
| @@ -2671,23 +2698,25 @@ to avoid growing too large. · 11 unmodified lines |
| 2671 | | 2698 | |
| 2672 | | 2699 | |
| 2673 | | 2700 | |
| 2674 | <hr><h3><a name="lua_concat"><code>lua_concat</code></a></h3> | 2701 | <hr><h3><a name="lua_concat"><code>lua_concat</code></a></h3><p> |
| | 2702 | <span class="apii">[-n, +1, <em>e</em>]</span> |
| 2675 | <pre>void lua_concat (lua_State *L, int n);</pre> | 2703 | <pre>void lua_concat (lua_State *L, int n);</pre> |
| 2676 | | 2704 | |
| 2677 | <p> | 2705 | <p> |
| 2678 | Concatenates the <code>n</code> values at the top of the stack, | 2706 | Concatenates the <code>n</code> values at the top of the stack, |
| 2679 | pops them, and leaves the result at the top. | 2707 | pops them, and leaves the result at the top. |
| 2680 | If <code>n</code> is 1, the result is the single string on the stack | 2708 | If <code>n</code> is 1, the result is the single value on the stack |
| 2681 | (that is, the function does nothing); | 2709 | (that is, the function does nothing); |
| 2682 | if <code>n</code> is 0, the result is the empty string. | 2710 | if <code>n</code> is 0, the result is the empty string. |
| 2683 | Concatenation is done following the usual semantics of Lua | 2711 | Concatenation is performed following the usual semantics of Lua |
| 2684 | (see <a href="#2.5.4">§2.5.4</a>). | 2712 | (see <a href="#2.5.4">§2.5.4</a>). |
| 2685 | | 2713 | |
| 2686 | | 2714 | |
| 2687 | | 2715 | |
| 2688 | | 2716 | |
| 2689 | | 2717 | |
| 2690 | <hr><h3><a name="lua_cpcall"><code>lua_cpcall</code></a></h3> | 2718 | <hr><h3><a name="lua_cpcall"><code>lua_cpcall</code></a></h3><p> |
| | 2719 | <span class="apii">[-0, +(0|1), <em>-</em>]</span> |
| 2691 | <pre>int lua_cpcall (lua_State *L, lua_CFunction func, void *ud);</pre> | 2720 | <pre>int lua_cpcall (lua_State *L, lua_CFunction func, void *ud);</pre> |
| 2692 | | 2721 | |
| 2693 | <p> | 2722 | <p> |
| @@ -2704,7 +2733,8 @@ All values returned by <code>func</code> are discarded. · 10 unmodified lines |
| 2704 | | 2733 | |
| 2705 | | 2734 | |
| 2706 | | 2735 | |
| 2707 | <hr><h3><a name="lua_createtable"><code>lua_createtable</code></a></h3> | 2736 | <hr><h3><a name="lua_createtable"><code>lua_createtable</code></a></h3><p> |
| | 2737 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 2708 | <pre>void lua_createtable (lua_State *L, int narr, int nrec);</pre> | 2738 | <pre>void lua_createtable (lua_State *L, int narr, int nrec);</pre> |
| 2709 | | 2739 | |
| 2710 | <p> | 2740 | <p> |
| @@ -2719,7 +2749,8 @@ Otherwise you can use the function <a href="#lua_newtable"><code>lua_newtable</c · 8 unmodified lines |
| 2719 | | 2749 | |
| 2720 | | 2750 | |
| 2721 | | 2751 | |
| 2722 | <hr><h3><a name="lua_dump"><code>lua_dump</code></a></h3> | 2752 | <hr><h3><a name="lua_dump"><code>lua_dump</code></a></h3><p> |
| | 2753 | <span class="apii">[-0, +0, <em>m</em>]</span> |
| 2723 | <pre>int lua_dump (lua_State *L, lua_Writer writer, void *data);</pre> | 2754 | <pre>int lua_dump (lua_State *L, lua_Writer writer, void *data);</pre> |
| 2724 | | 2755 | |
| 2725 | <p> | 2756 | <p> |
| @@ -2747,7 +2778,8 @@ This function does not pop the Lua function from the stack. · 21 unmodified lines |
| 2747 | | 2778 | |
| 2748 | | 2779 | |
| 2749 | | 2780 | |
| 2750 | <hr><h3><a name="lua_equal"><code>lua_equal</code></a></h3> | 2781 | <hr><h3><a name="lua_equal"><code>lua_equal</code></a></h3><p> |
| | 2782 | <span class="apii">[-0, +0, <em>e</em>]</span> |
| 2751 | <pre>int lua_equal (lua_State *L, int index1, int index2);</pre> | 2783 | <pre>int lua_equal (lua_State *L, int index1, int index2);</pre> |
| 2752 | | 2784 | |
| 2753 | <p> | 2785 | <p> |
| @@ -2762,7 +2794,8 @@ Also returns 0 if any of the indices is non valid. · 8 unmodified lines |
| 2762 | | 2794 | |
| 2763 | | 2795 | |
| 2764 | | 2796 | |
| 2765 | <hr><h3><a name="lua_error"><code>lua_error</code></a></h3> | 2797 | <hr><h3><a name="lua_error"><code>lua_error</code></a></h3><p> |
| | 2798 | <span class="apii">[-1, +0, <em>v</em>]</span> |
| 2766 | <pre>int lua_error (lua_State *L);</pre> | 2799 | <pre>int lua_error (lua_State *L);</pre> |
| 2767 | | 2800 | |
| 2768 | <p> | 2801 | <p> |
| @@ -2777,7 +2810,8 @@ and therefore never returns. · 8 unmodified lines |
| 2777 | | 2810 | |
| 2778 | | 2811 | |
| 2779 | | 2812 | |
| 2780 | <hr><h3><a name="lua_gc"><code>lua_gc</code></a></h3> | 2813 | <hr><h3><a name="lua_gc"><code>lua_gc</code></a></h3><p> |
| | 2814 | <span class="apii">[-0, +0, <em>e</em>]</span> |
| 2781 | <pre>int lua_gc (lua_State *L, int what, int data);</pre> | 2815 | <pre>int lua_gc (lua_State *L, int what, int data);</pre> |
| 2782 | | 2816 | |
| 2783 | <p> | 2817 | <p> |
| @@ -2838,7 +2872,8 @@ The function returns the previous value of the step multiplier. · 54 unmodified lines |
| 2838 | | 2872 | |
| 2839 | | 2873 | |
| 2840 | | 2874 | |
| 2841 | <hr><h3><a name="lua_getallocf"><code>lua_getallocf</code></a></h3> | 2875 | <hr><h3><a name="lua_getallocf"><code>lua_getallocf</code></a></h3><p> |
| | 2876 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 2842 | <pre>lua_Alloc lua_getallocf (lua_State *L, void **ud);</pre> | 2877 | <pre>lua_Alloc lua_getallocf (lua_State *L, void **ud);</pre> |
| 2843 | | 2878 | |
| 2844 | <p> | 2879 | <p> |
| @@ -2850,7 +2885,8 @@ opaque pointer passed to <a href="#lua_newstate"><code>lua_newstate</code></a>. · 5 unmodified lines |
| 2850 | | 2885 | |
| 2851 | | 2886 | |
| 2852 | | 2887 | |
| 2853 | <hr><h3><a name="lua_getfenv"><code>lua_getfenv</code></a></h3> | 2888 | <hr><h3><a name="lua_getfenv"><code>lua_getfenv</code></a></h3><p> |
| | 2889 | <span class="apii">[-0, +1, <em>-</em>]</span> |
| 2854 | <pre>void lua_getfenv (lua_State *L, int index);</pre> | 2890 | <pre>void lua_getfenv (lua_State *L, int index);</pre> |
| 2855 | | 2891 | |
| 2856 | <p> | 2892 | <p> |
| @@ -2861,12 +2897,13 @@ the value at the given index. · 4 unmodified lines |
| 2861 | | 2897 | |
| 2862 | | 2898 | |
| 2863 | | 2899 | |
| 2864 | <hr><h3><a name="lua_getfield"><code>lua_getfield</code></a></h3> | 2900 | <hr><h3><a name="lua_getfield"><code>lua_getfield</code></a></h3><p> |
| | 2901 | <span class="apii">[-0, +1, <em>e</em>]</span> |
| 2865 | <pre>void lua_getfield (lua_State *L, int index, const char *k);</pre> | 2902 | <pre>void lua_getfield (lua_State *L, int index, const char *k);</pre> |
| 2866 | | 2903 | |
| 2867 | <p> | 2904 | <p> |
| 2868 | Pushes onto the stack the value <code>t[k]</code>, | 2905 | Pushes onto the stack the value <code>t[k]</code>, |
| 2869 | where <code>t</code> is the value at the given valid index <code>index</code>. | 2906 | where <code>t</code> is the value at the given valid index. |
| 2870 | As in Lua, this function may trigger a metamethod | 2907 | As in Lua, this function may trigger a metamethod |
| 2871 | for the "index" event (see <a href="#2.8">§2.8</a>). | 2908 | for the "index" event (see <a href="#2.8">§2.8</a>). |
| 2872 | | 2909 | |
| @@ -2874,7 +2911,8 @@ for the "index" event (see <a href="#2.8">§2.8</a>). · 1 unmodified line |
| 2874 | | 2911 | |
| 2875 | | 2912 | |
| 2876 | | 2913 | |
| 2877 | <hr><h3><a name="lua_getglobal"><code>lua_getglobal</code></a></h3> | 2914 | <hr><h3><a name="lua_getglobal"><code>lua_getglobal</code></a></h3><p> |
| | 2915 | <span class="apii">[-0, +1, <em>e</em>]</span> |
| 2878 | <pre>void lua_getglobal (lua_State *L, const char *name);</pre> | 2916 | <pre>void lua_getglobal (lua_State *L, const char *name);</pre> |
| 2879 | | 2917 | |
| 2880 | <p> | 2918 | <p> |
| @@ -2888,7 +2926,8 @@ It is defined as a macro: · 7 unmodified lines |
| 2888 | | 2926 | |
| 2889 | | 2927 | |
| 2890 | | 2928 | |
| 2891 | <hr><h3><a name="lua_getmetatable"><code>lua_getmetatable</code></a></h3> | 2929 | <hr><h3><a name="lua_getmetatable"><code>lua_getmetatable</code></a></h3><p> |
| | 2930 | <span class="apii">[-0, +(0|1), <em>-</em>]</span> |
| 2892 | <pre>int lua_getmetatable (lua_State *L, int index);</pre> | 2931 | <pre>int lua_getmetatable (lua_State *L, int index);</pre> |
| 2893 | | 2932 | |
| 2894 | <p> | 2933 | <p> |
| @@ -2902,12 +2941,13 @@ the function returns 0 and pushes nothing on the stack. · 7 unmodified lines |
| 2902 | | 2941 | |
| 2903 | | 2942 | |
| 2904 | | 2943 | |
| 2905 | <hr><h3><a name="lua_gettable"><code>lua_gettable</code></a></h3> | 2944 | <hr><h3><a name="lua_gettable"><code>lua_gettable</code></a></h3><p> |
| | 2945 | <span class="apii">[-1, +1, <em>e</em>]</span> |
| 2906 | <pre>void lua_gettable (lua_State *L, int index);</pre> | 2946 | <pre>void lua_gettable (lua_State *L, int index);</pre> |
| 2907 | | 2947 | |
| 2908 | <p> | 2948 | <p> |
| 2909 | Pushes onto the stack the value <code>t[k]</code>, | 2949 | Pushes onto the stack the value <code>t[k]</code>, |
| 2910 | where <code>t</code> is the value at the given valid index <code>index</code> | 2950 | where <code>t</code> is the value at the given valid index |
| 2911 | and <code>k</code> is the value at the top of the stack. | 2951 | and <code>k</code> is the value at the top of the stack. |
| 2912 | | 2952 | |
| 2913 | | 2953 | |
| @@ -2921,7 +2961,8 @@ for the "index" event (see <a href="#2.8">§2.8</a>). · 7 unmodified lines |
| 2921 | | 2961 | |
| 2922 | | 2962 | |
| 2923 | | 2963 | |
| 2924 | <hr><h3><a name="lua_gettop"><code>lua_gettop</code></a></h3> | 2964 | <hr><h3><a name="lua_gettop"><code>lua_gettop</code></a></h3><p> |
| | 2965 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 2925 | <pre>int lua_gettop (lua_State *L);</pre> | 2966 | <pre>int lua_gettop (lua_State *L);</pre> |
| 2926 | | 2967 | |
| 2927 | <p> | 2968 | <p> |
| @@ -2934,7 +2975,8 @@ this result is equal to the number of elements in the stack · 6 unmodified lines |
| 2934 | | 2975 | |
| 2935 | | 2976 | |
| 2936 | | 2977 | |
| 2937 | <hr><h3><a name="lua_insert"><code>lua_insert</code></a></h3> | 2978 | <hr><h3><a name="lua_insert"><code>lua_insert</code></a></h3><p> |
| | 2979 | <span class="apii">[-1, +1, <em>-</em>]</span> |
| 2938 | <pre>void lua_insert (lua_State *L, int index);</pre> | 2980 | <pre>void lua_insert (lua_State *L, int index);</pre> |
| 2939 | | 2981 | |
| 2940 | <p> | 2982 | <p> |
| @@ -2963,7 +3005,8 @@ which is usually the largest signed integral type the machine handles · 22 unmodified lines |
| 2963 | | 3005 | |
| 2964 | | 3006 | |
| 2965 | | 3007 | |
| 2966 | <hr><h3><a name="lua_isboolean"><code>lua_isboolean</code></a></h3> | 3008 | <hr><h3><a name="lua_isboolean"><code>lua_isboolean</code></a></h3><p> |
| | 3009 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 2967 | <pre>int lua_isboolean (lua_State *L, int index);</pre> | 3010 | <pre>int lua_isboolean (lua_State *L, int index);</pre> |
| 2968 | | 3011 | |
| 2969 | <p> | 3012 | <p> |
| @@ -2974,7 +3017,8 @@ and 0 otherwise. · 4 unmodified lines |
| 2974 | | 3017 | |
| 2975 | | 3018 | |
| 2976 | | 3019 | |
| 2977 | <hr><h3><a name="lua_iscfunction"><code>lua_iscfunction</code></a></h3> | 3020 | <hr><h3><a name="lua_iscfunction"><code>lua_iscfunction</code></a></h3><p> |
| | 3021 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 2978 | <pre>int lua_iscfunction (lua_State *L, int index);</pre> | 3022 | <pre>int lua_iscfunction (lua_State *L, int index);</pre> |
| 2979 | | 3023 | |
| 2980 | <p> | 3024 | <p> |
| @@ -2985,7 +3029,8 @@ and 0 otherwise. · 4 unmodified lines |
| 2985 | | 3029 | |
| 2986 | | 3030 | |
| 2987 | | 3031 | |
| 2988 | <hr><h3><a name="lua_isfunction"><code>lua_isfunction</code></a></h3> | 3032 | <hr><h3><a name="lua_isfunction"><code>lua_isfunction</code></a></h3><p> |
| | 3033 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 2989 | <pre>int lua_isfunction (lua_State *L, int index);</pre> | 3034 | <pre>int lua_isfunction (lua_State *L, int index);</pre> |
| 2990 | | 3035 | |
| 2991 | <p> | 3036 | <p> |
| @@ -2996,7 +3041,8 @@ Returns 1 if the value at the given acceptable index is a function · 4 unmodified lines |
| 2996 | | 3041 | |
| 2997 | | 3042 | |
| 2998 | | 3043 | |
| 2999 | <hr><h3><a name="lua_islightuserdata"><code>lua_islightuserdata</code></a></h3> | 3044 | <hr><h3><a name="lua_islightuserdata"><code>lua_islightuserdata</code></a></h3><p> |
| | 3045 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3000 | <pre>int lua_islightuserdata (lua_State *L, int index);</pre> | 3046 | <pre>int lua_islightuserdata (lua_State *L, int index);</pre> |
| 3001 | | 3047 | |
| 3002 | <p> | 3048 | <p> |
| @@ -3007,7 +3053,8 @@ and 0 otherwise. · 4 unmodified lines |
| 3007 | | 3053 | |
| 3008 | | 3054 | |
| 3009 | | 3055 | |
| 3010 | <hr><h3><a name="lua_isnil"><code>lua_isnil</code></a></h3> | 3056 | <hr><h3><a name="lua_isnil"><code>lua_isnil</code></a></h3><p> |
| | 3057 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3011 | <pre>int lua_isnil (lua_State *L, int index);</pre> | 3058 | <pre>int lua_isnil (lua_State *L, int index);</pre> |
| 3012 | | 3059 | |
| 3013 | <p> | 3060 | <p> |
| @@ -3018,11 +3065,12 @@ and 0 otherwise. · 4 unmodified lines |
| 3018 | | 3065 | |
| 3019 | | 3066 | |
| 3020 | | 3067 | |
| 3021 | <hr><h3><a name="lua_isnone"><code>lua_isnone</code></a></h3> | 3068 | <hr><h3><a name="lua_isnone"><code>lua_isnone</code></a></h3><p> |
| | 3069 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3022 | <pre>int lua_isnone (lua_State *L, int index);</pre> | 3070 | <pre>int lua_isnone (lua_State *L, int index);</pre> |
| 3023 | | 3071 | |
| 3024 | <p> | 3072 | <p> |
| 3025 | Returns 1 if the the given acceptable index is not valid | 3073 | Returns 1 if the given acceptable index is not valid |
| 3026 | (that is, it refers to an element outside the current stack), | 3074 | (that is, it refers to an element outside the current stack), |
| 3027 | and 0 otherwise. | 3075 | and 0 otherwise. |
| 3028 | | 3076 | |
| @@ -3030,11 +3078,12 @@ and 0 otherwise. · 1 unmodified line |
| 3030 | | 3078 | |
| 3031 | | 3079 | |
| 3032 | | 3080 | |
| 3033 | <hr><h3><a name="lua_isnoneornil"><code>lua_isnoneornil</code></a></h3> | 3081 | <hr><h3><a name="lua_isnoneornil"><code>lua_isnoneornil</code></a></h3><p> |
| | 3082 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3034 | <pre>int lua_isnoneornil (lua_State *L, int index);</pre> | 3083 | <pre>int lua_isnoneornil (lua_State *L, int index);</pre> |
| 3035 | | 3084 | |
| 3036 | <p> | 3085 | <p> |
| 3037 | Returns 1 if the the given acceptable index is not valid | 3086 | Returns 1 if the given acceptable index is not valid |
| 3038 | (that is, it refers to an element outside the current stack) | 3087 | (that is, it refers to an element outside the current stack) |
| 3039 | or if the value at this index is <b>nil</b>, | 3088 | or if the value at this index is <b>nil</b>, |
| 3040 | and 0 otherwise. | 3089 | and 0 otherwise. |
| @@ -3043,7 +3092,8 @@ and 0 otherwise. · 2 unmodified lines |
| 3043 | | 3092 | |
| 3044 | | 3093 | |
| 3045 | | 3094 | |
| 3046 | <hr><h3><a name="lua_isnumber"><code>lua_isnumber</code></a></h3> | 3095 | <hr><h3><a name="lua_isnumber"><code>lua_isnumber</code></a></h3><p> |
| | 3096 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3047 | <pre>int lua_isnumber (lua_State *L, int index);</pre> | 3097 | <pre>int lua_isnumber (lua_State *L, int index);</pre> |
| 3048 | | 3098 | |
| 3049 | <p> | 3099 | <p> |
| @@ -3055,7 +3105,8 @@ and 0 otherwise. · 5 unmodified lines |
| 3055 | | 3105 | |
| 3056 | | 3106 | |
| 3057 | | 3107 | |
| 3058 | <hr><h3><a name="lua_isstring"><code>lua_isstring</code></a></h3> | 3108 | <hr><h3><a name="lua_isstring"><code>lua_isstring</code></a></h3><p> |
| | 3109 | <span class="apii">[-0, +0, <em>m</em>]</span> |
| 3059 | <pre>int lua_isstring (lua_State *L, int index);</pre> | 3110 | <pre>int lua_isstring (lua_State *L, int index);</pre> |
| 3060 | | 3111 | |
| 3061 | <p> | 3112 | <p> |
| @@ -3067,7 +3118,8 @@ and 0 otherwise. · 5 unmodified lines |
| 3067 | | 3118 | |
| 3068 | | 3119 | |
| 3069 | | 3120 | |
| 3070 | <hr><h3><a name="lua_istable"><code>lua_istable</code></a></h3> | 3121 | <hr><h3><a name="lua_istable"><code>lua_istable</code></a></h3><p> |
| | 3122 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3071 | <pre>int lua_istable (lua_State *L, int index);</pre> | 3123 | <pre>int lua_istable (lua_State *L, int index);</pre> |
| 3072 | | 3124 | |
| 3073 | <p> | 3125 | <p> |
| @@ -3078,7 +3130,8 @@ and 0 otherwise. · 4 unmodified lines |
| 3078 | | 3130 | |
| 3079 | | 3131 | |
| 3080 | | 3132 | |
| 3081 | <hr><h3><a name="lua_isthread"><code>lua_isthread</code></a></h3> | 3133 | <hr><h3><a name="lua_isthread"><code>lua_isthread</code></a></h3><p> |
| | 3134 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3082 | <pre>int lua_isthread (lua_State *L, int index);</pre> | 3135 | <pre>int lua_isthread (lua_State *L, int index);</pre> |
| 3083 | | 3136 | |
| 3084 | <p> | 3137 | <p> |
| @@ -3089,7 +3142,8 @@ and 0 otherwise. · 4 unmodified lines |
| 3089 | | 3142 | |
| 3090 | | 3143 | |
| 3091 | | 3144 | |
| 3092 | <hr><h3><a name="lua_isuserdata"><code>lua_isuserdata</code></a></h3> | 3145 | <hr><h3><a name="lua_isuserdata"><code>lua_isuserdata</code></a></h3><p> |
| | 3146 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3093 | <pre>int lua_isuserdata (lua_State *L, int index);</pre> | 3147 | <pre>int lua_isuserdata (lua_State *L, int index);</pre> |
| 3094 | | 3148 | |
| 3095 | <p> | 3149 | <p> |
| @@ -3100,7 +3154,8 @@ Returns 1 if the value at the given acceptable index is a userdata · 4 unmodified lines |
| 3100 | | 3154 | |
| 3101 | | 3155 | |
| 3102 | | 3156 | |
| 3103 | <hr><h3><a name="lua_lessthan"><code>lua_lessthan</code></a></h3> | 3157 | <hr><h3><a name="lua_lessthan"><code>lua_lessthan</code></a></h3><p> |
| | 3158 | <span class="apii">[-0, +0, <em>e</em>]</span> |
| 3104 | <pre>int lua_lessthan (lua_State *L, int index1, int index2);</pre> | 3159 | <pre>int lua_lessthan (lua_State *L, int index1, int index2);</pre> |
| 3105 | | 3160 | |
| 3106 | <p> | 3161 | <p> |
| @@ -3115,7 +3170,8 @@ Also returns 0 if any of the indices is non valid. · 8 unmodified lines |
| 3115 | | 3170 | |
| 3116 | | 3171 | |
| 3117 | | 3172 | |
| 3118 | <hr><h3><a name="lua_load"><code>lua_load</code></a></h3> | 3173 | <hr><h3><a name="lua_load"><code>lua_load</code></a></h3><p> |
| | 3174 | <span class="apii">[-0, +1, <em>-</em>]</span> |
| 3119 | <pre>int lua_load (lua_State *L, | 3175 | <pre>int lua_load (lua_State *L, |
| 3120 | lua_Reader reader, | 3176 | lua_Reader reader, |
| 3121 | void *data, | 3177 | void *data, |
| @@ -3165,7 +3221,8 @@ which is used for error messages and in debug information (see <a href="#3.8">&s · 43 unmodified lines |
| 3165 | | 3221 | |
| 3166 | | 3222 | |
| 3167 | | 3223 | |
| 3168 | <hr><h3><a name="lua_newstate"><code>lua_newstate</code></a></h3> | 3224 | <hr><h3><a name="lua_newstate"><code>lua_newstate</code></a></h3><p> |
| | 3225 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3169 | <pre>lua_State *lua_newstate (lua_Alloc f, void *ud);</pre> | 3226 | <pre>lua_State *lua_newstate (lua_Alloc f, void *ud);</pre> |
| 3170 | | 3227 | |
| 3171 | <p> | 3228 | <p> |
| @@ -3181,7 +3238,8 @@ simply passes to the allocator in every call. · 9 unmodified lines |
| 3181 | | 3238 | |
| 3182 | | 3239 | |
| 3183 | | 3240 | |
| 3184 | <hr><h3><a name="lua_newtable"><code>lua_newtable</code></a></h3> | 3241 | <hr><h3><a name="lua_newtable"><code>lua_newtable</code></a></h3><p> |
| | 3242 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 3185 | <pre>void lua_newtable (lua_State *L);</pre> | 3243 | <pre>void lua_newtable (lua_State *L);</pre> |
| 3186 | | 3244 | |
| 3187 | <p> | 3245 | <p> |
| @@ -3192,7 +3250,8 @@ It is equivalent to <code>lua_createtable(L, 0, 0)</code>. · 4 unmodified lines |
| 3192 | | 3250 | |
| 3193 | | 3251 | |
| 3194 | | 3252 | |
| 3195 | <hr><h3><a name="lua_newthread"><code>lua_newthread</code></a></h3> | 3253 | <hr><h3><a name="lua_newthread"><code>lua_newthread</code></a></h3><p> |
| | 3254 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 3196 | <pre>lua_State *lua_newthread (lua_State *L);</pre> | 3255 | <pre>lua_State *lua_newthread (lua_State *L);</pre> |
| 3197 | | 3256 | |
| 3198 | <p> | 3257 | <p> |
| @@ -3212,7 +3271,8 @@ like any Lua object. · 13 unmodified lines |
| 3212 | | 3271 | |
| 3213 | | 3272 | |
| 3214 | | 3273 | |
| 3215 | <hr><h3><a name="lua_newuserdata"><code>lua_newuserdata</code></a></h3> | 3274 | <hr><h3><a name="lua_newuserdata"><code>lua_newuserdata</code></a></h3><p> |
| | 3275 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 3216 | <pre>void *lua_newuserdata (lua_State *L, size_t size);</pre> | 3276 | <pre>void *lua_newuserdata (lua_State *L, size_t size);</pre> |
| 3217 | | 3277 | |
| 3218 | <p> | 3278 | <p> |
| @@ -3240,7 +3300,8 @@ Lua frees its corresponding memory. · 21 unmodified lines |
| 3240 | | 3300 | |
| 3241 | | 3301 | |
| 3242 | | 3302 | |
| 3243 | <hr><h3><a name="lua_next"><code>lua_next</code></a></h3> | 3303 | <hr><h3><a name="lua_next"><code>lua_next</code></a></h3><p> |
| | 3304 | <span class="apii">[-1, +(2|0), <em>e</em>]</span> |
| 3244 | <pre>int lua_next (lua_State *L, int index);</pre> | 3305 | <pre>int lua_next (lua_State *L, int index);</pre> |
| 3245 | | 3306 | |
| 3246 | <p> | 3307 | <p> |
| @@ -3295,7 +3356,8 @@ Lua to operate with another type for numbers (e.g., float or long). · 48 unmodified lines |
| 3295 | | 3356 | |
| 3296 | | 3357 | |
| 3297 | | 3358 | |
| 3298 | <hr><h3><a name="lua_objlen"><code>lua_objlen</code></a></h3> | 3359 | <hr><h3><a name="lua_objlen"><code>lua_objlen</code></a></h3><p> |
| | 3360 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3299 | <pre>size_t lua_objlen (lua_State *L, int index);</pre> | 3361 | <pre>size_t lua_objlen (lua_State *L, int index);</pre> |
| 3300 | | 3362 | |
| 3301 | <p> | 3363 | <p> |
| @@ -3310,7 +3372,8 @@ for other values, it is 0. · 8 unmodified lines |
| 3310 | | 3372 | |
| 3311 | | 3373 | |
| 3312 | | 3374 | |
| 3313 | <hr><h3><a name="lua_pcall"><code>lua_pcall</code></a></h3> | 3375 | <hr><h3><a name="lua_pcall"><code>lua_pcall</code></a></h3><p> |
| | 3376 | <span class="apii">[-(nargs + 1), +(nresults|1), <em>-</em>]</span> |
| 3314 | <pre>int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc);</pre> | 3377 | <pre>int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc);</pre> |
| 3315 | | 3378 | |
| 3316 | <p> | 3379 | <p> |
| @@ -3375,7 +3438,8 @@ error while running the error handler function. · 58 unmodified lines |
| 3375 | | 3438 | |
| 3376 | | 3439 | |
| 3377 | | 3440 | |
| 3378 | <hr><h3><a name="lua_pop"><code>lua_pop</code></a></h3> | 3441 | <hr><h3><a name="lua_pop"><code>lua_pop</code></a></h3><p> |
| | 3442 | <span class="apii">[-n, +0, <em>-</em>]</span> |
| 3379 | <pre>void lua_pop (lua_State *L, int n);</pre> | 3443 | <pre>void lua_pop (lua_State *L, int n);</pre> |
| 3380 | | 3444 | |
| 3381 | <p> | 3445 | <p> |
| @@ -3385,7 +3449,8 @@ Pops <code>n</code> elements from the stack. · 3 unmodified lines |
| 3385 | | 3449 | |
| 3386 | | 3450 | |
| 3387 | | 3451 | |
| 3388 | <hr><h3><a name="lua_pushboolean"><code>lua_pushboolean</code></a></h3> | 3452 | <hr><h3><a name="lua_pushboolean"><code>lua_pushboolean</code></a></h3><p> |
| | 3453 | <span class="apii">[-0, +1, <em>-</em>]</span> |
| 3389 | <pre>void lua_pushboolean (lua_State *L, int b);</pre> | 3454 | <pre>void lua_pushboolean (lua_State *L, int b);</pre> |
| 3390 | | 3455 | |
| 3391 | <p> | 3456 | <p> |
| @@ -3395,7 +3460,8 @@ Pushes a boolean value with value <code>b</code> onto the stack. · 3 unmodified lines |
| 3395 | | 3460 | |
| 3396 | | 3461 | |
| 3397 | | 3462 | |
| 3398 | <hr><h3><a name="lua_pushcclosure"><code>lua_pushcclosure</code></a></h3> | 3463 | <hr><h3><a name="lua_pushcclosure"><code>lua_pushcclosure</code></a></h3><p> |
| | 3464 | <span class="apii">[-n, +1, <em>m</em>]</span> |
| 3399 | <pre>void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);</pre> | 3465 | <pre>void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);</pre> |
| 3400 | | 3466 | |
| 3401 | <p> | 3467 | <p> |
| @@ -3420,7 +3486,8 @@ associated with the function. · 18 unmodified lines |
| 3420 | | 3486 | |
| 3421 | | 3487 | |
| 3422 | | 3488 | |
| 3423 | <hr><h3><a name="lua_pushcfunction"><code>lua_pushcfunction</code></a></h3> | 3489 | <hr><h3><a name="lua_pushcfunction"><code>lua_pushcfunction</code></a></h3><p> |
| | 3490 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 3424 | <pre>void lua_pushcfunction (lua_State *L, lua_CFunction f);</pre> | 3491 | <pre>void lua_pushcfunction (lua_State *L, lua_CFunction f);</pre> |
| 3425 | | 3492 | |
| 3426 | <p> | 3493 | <p> |
| @@ -3446,7 +3513,8 @@ and return its results (see <a href="#lua_CFunction"><code>lua_CFunction</code>< · 19 unmodified lines |
| 3446 | | 3513 | |
| 3447 | | 3514 | |
| 3448 | | 3515 | |
| 3449 | <hr><h3><a name="lua_pushfstring"><code>lua_pushfstring</code></a></h3> | 3516 | <hr><h3><a name="lua_pushfstring"><code>lua_pushfstring</code></a></h3><p> |
| | 3517 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 3450 | <pre>const char *lua_pushfstring (lua_State *L, const char *fmt, ...);</pre> | 3518 | <pre>const char *lua_pushfstring (lua_State *L, const char *fmt, ...);</pre> |
| 3451 | | 3519 | |
| 3452 | <p> | 3520 | <p> |
| @@ -3480,7 +3548,8 @@ The conversion specifiers can only be · 27 unmodified lines |
| 3480 | | 3548 | |
| 3481 | | 3549 | |
| 3482 | | 3550 | |
| 3483 | <hr><h3><a name="lua_pushinteger"><code>lua_pushinteger</code></a></h3> | 3551 | <hr><h3><a name="lua_pushinteger"><code>lua_pushinteger</code></a></h3><p> |
| | 3552 | <span class="apii">[-0, +1, <em>-</em>]</span> |
| 3484 | <pre>void lua_pushinteger (lua_State *L, lua_Integer n);</pre> | 3553 | <pre>void lua_pushinteger (lua_State *L, lua_Integer n);</pre> |
| 3485 | | 3554 | |
| 3486 | <p> | 3555 | <p> |
| @@ -3490,7 +3559,8 @@ Pushes a number with value <code>n</code> onto the stack. · 3 unmodified lines |
| 3490 | | 3559 | |
| 3491 | | 3560 | |
| 3492 | | 3561 | |
| 3493 | <hr><h3><a name="lua_pushlightuserdata"><code>lua_pushlightuserdata</code></a></h3> | 3562 | <hr><h3><a name="lua_pushlightuserdata"><code>lua_pushlightuserdata</code></a></h3><p> |
| | 3563 | <span class="apii">[-0, +1, <em>-</em>]</span> |
| 3494 | <pre>void lua_pushlightuserdata (lua_State *L, void *p);</pre> | 3564 | <pre>void lua_pushlightuserdata (lua_State *L, void *p);</pre> |
| 3495 | | 3565 | |
| 3496 | <p> | 3566 | <p> |
| @@ -3510,7 +3580,8 @@ light userdata with the same C address. · 13 unmodified lines |
| 3510 | | 3580 | |
| 3511 | | 3581 | |
| 3512 | | 3582 | |
| 3513 | <hr><h3><a name="lua_pushlstring"><code>lua_pushlstring</code></a></h3> | 3583 | <hr><h3><a name="lua_pushlstring"><code>lua_pushlstring</code></a></h3><p> |
| | 3584 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 3514 | <pre>void lua_pushlstring (lua_State *L, const char *s, size_t len);</pre> | 3585 | <pre>void lua_pushlstring (lua_State *L, const char *s, size_t len);</pre> |
| 3515 | | 3586 | |
| 3516 | <p> | 3587 | <p> |
| @@ -3525,7 +3596,8 @@ The string can contain embedded zeros. · 8 unmodified lines |
| 3525 | | 3596 | |
| 3526 | | 3597 | |
| 3527 | | 3598 | |
| 3528 | <hr><h3><a name="lua_pushnil"><code>lua_pushnil</code></a></h3> | 3599 | <hr><h3><a name="lua_pushnil"><code>lua_pushnil</code></a></h3><p> |
| | 3600 | <span class="apii">[-0, +1, <em>-</em>]</span> |
| 3529 | <pre>void lua_pushnil (lua_State *L);</pre> | 3601 | <pre>void lua_pushnil (lua_State *L);</pre> |
| 3530 | | 3602 | |
| 3531 | <p> | 3603 | <p> |
| @@ -3535,7 +3607,8 @@ Pushes a nil value onto the stack. · 3 unmodified lines |
| 3535 | | 3607 | |
| 3536 | | 3608 | |
| 3537 | | 3609 | |
| 3538 | <hr><h3><a name="lua_pushnumber"><code>lua_pushnumber</code></a></h3> | 3610 | <hr><h3><a name="lua_pushnumber"><code>lua_pushnumber</code></a></h3><p> |
| | 3611 | <span class="apii">[-0, +1, <em>-</em>]</span> |
| 3539 | <pre>void lua_pushnumber (lua_State *L, lua_Number n);</pre> | 3612 | <pre>void lua_pushnumber (lua_State *L, lua_Number n);</pre> |
| 3540 | | 3613 | |
| 3541 | <p> | 3614 | <p> |
| @@ -3545,7 +3618,8 @@ Pushes a number with value <code>n</code> onto the stack. · 3 unmodified lines |
| 3545 | | 3618 | |
| 3546 | | 3619 | |
| 3547 | | 3620 | |
| 3548 | <hr><h3><a name="lua_pushstring"><code>lua_pushstring</code></a></h3> | 3621 | <hr><h3><a name="lua_pushstring"><code>lua_pushstring</code></a></h3><p> |
| | 3622 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 3549 | <pre>void lua_pushstring (lua_State *L, const char *s);</pre> | 3623 | <pre>void lua_pushstring (lua_State *L, const char *s);</pre> |
| 3550 | | 3624 | |
| 3551 | <p> | 3625 | <p> |
| @@ -3561,7 +3635,8 @@ it is assumed to end at the first zero. · 9 unmodified lines |
| 3561 | | 3635 | |
| 3562 | | 3636 | |
| 3563 | | 3637 | |
| 3564 | <hr><h3><a name="lua_pushthread"><code>lua_pushthread</code></a></h3> | 3638 | <hr><h3><a name="lua_pushthread"><code>lua_pushthread</code></a></h3><p> |
| | 3639 | <span class="apii">[-0, +1, <em>-</em>]</span> |
| 3565 | <pre>int lua_pushthread (lua_State *L);</pre> | 3640 | <pre>int lua_pushthread (lua_State *L);</pre> |
| 3566 | | 3641 | |
| 3567 | <p> | 3642 | <p> |
| @@ -3572,7 +3647,8 @@ Returns 1 if this thread is the main thread of its state. · 4 unmodified lines |
| 3572 | | 3647 | |
| 3573 | | 3648 | |
| 3574 | | 3649 | |
| 3575 | <hr><h3><a name="lua_pushvalue"><code>lua_pushvalue</code></a></h3> | 3650 | <hr><h3><a name="lua_pushvalue"><code>lua_pushvalue</code></a></h3><p> |
| | 3651 | <span class="apii">[-0, +1, <em>-</em>]</span> |
| 3576 | <pre>void lua_pushvalue (lua_State *L, int index);</pre> | 3652 | <pre>void lua_pushvalue (lua_State *L, int index);</pre> |
| 3577 | | 3653 | |
| 3578 | <p> | 3654 | <p> |
| @@ -3583,7 +3659,8 @@ onto the stack. · 4 unmodified lines |
| 3583 | | 3659 | |
| 3584 | | 3660 | |
| 3585 | | 3661 | |
| 3586 | <hr><h3><a name="lua_pushvfstring"><code>lua_pushvfstring</code></a></h3> | 3662 | <hr><h3><a name="lua_pushvfstring"><code>lua_pushvfstring</code></a></h3><p> |
| | 3663 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 3587 | <pre>const char *lua_pushvfstring (lua_State *L, | 3664 | <pre>const char *lua_pushvfstring (lua_State *L, |
| 3588 | const char *fmt, | 3665 | const char *fmt, |
| 3589 | va_list argp);</pre> | 3666 | va_list argp);</pre> |
| @@ -3596,7 +3673,8 @@ instead of a variable number of arguments. · 6 unmodified lines |
| 3596 | | 3673 | |
| 3597 | | 3674 | |
| 3598 | | 3675 | |
| 3599 | <hr><h3><a name="lua_rawequal"><code>lua_rawequal</code></a></h3> | 3676 | <hr><h3><a name="lua_rawequal"><code>lua_rawequal</code></a></h3><p> |
| | 3677 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3600 | <pre>int lua_rawequal (lua_State *L, int index1, int index2);</pre> | 3678 | <pre>int lua_rawequal (lua_State *L, int index1, int index2);</pre> |
| 3601 | | 3679 | |
| 3602 | <p> | 3680 | <p> |
| @@ -3610,7 +3688,8 @@ Also returns 0 if any of the indices are non valid. · 7 unmodified lines |
| 3610 | | 3688 | |
| 3611 | | 3689 | |
| 3612 | | 3690 | |
| 3613 | <hr><h3><a name="lua_rawget"><code>lua_rawget</code></a></h3> | 3691 | <hr><h3><a name="lua_rawget"><code>lua_rawget</code></a></h3><p> |
| | 3692 | <span class="apii">[-1, +1, <em>-</em>]</span> |
| 3614 | <pre>void lua_rawget (lua_State *L, int index);</pre> | 3693 | <pre>void lua_rawget (lua_State *L, int index);</pre> |
| 3615 | | 3694 | |
| 3616 | <p> | 3695 | <p> |
| @@ -3621,12 +3700,13 @@ Similar to <a href="#lua_gettable"><code>lua_gettable</code></a>, but does a raw · 4 unmodified lines |
| 3621 | | 3700 | |
| 3622 | | 3701 | |
| 3623 | | 3702 | |
| 3624 | <hr><h3><a name="lua_rawgeti"><code>lua_rawgeti</code></a></h3> | 3703 | <hr><h3><a name="lua_rawgeti"><code>lua_rawgeti</code></a></h3><p> |
| | 3704 | <span class="apii">[-0, +1, <em>-</em>]</span> |
| 3625 | <pre>void lua_rawgeti (lua_State *L, int index, int n);</pre> | 3705 | <pre>void lua_rawgeti (lua_State *L, int index, int n);</pre> |
| 3626 | | 3706 | |
| 3627 | <p> | 3707 | <p> |
| 3628 | Pushes onto the stack the value <code>t[n]</code>, | 3708 | Pushes onto the stack the value <code>t[n]</code>, |
| 3629 | where <code>t</code> is the value at the given valid index <code>index</code>. | 3709 | where <code>t</code> is the value at the given valid index. |
| 3630 | The access is raw; | 3710 | The access is raw; |
| 3631 | that is, it does not invoke metamethods. | 3711 | that is, it does not invoke metamethods. |
| 3632 | | 3712 | |
| @@ -3634,7 +3714,8 @@ that is, it does not invoke metamethods. · 1 unmodified line |
| 3634 | | 3714 | |
| 3635 | | 3715 | |
| 3636 | | 3716 | |
| 3637 | <hr><h3><a name="lua_rawset"><code>lua_rawset</code></a></h3> | 3717 | <hr><h3><a name="lua_rawset"><code>lua_rawset</code></a></h3><p> |
| | 3718 | <span class="apii">[-2, +0, <em>m</em>]</span> |
| 3638 | <pre>void lua_rawset (lua_State *L, int index);</pre> | 3719 | <pre>void lua_rawset (lua_State *L, int index);</pre> |
| 3639 | | 3720 | |
| 3640 | <p> | 3721 | <p> |
| @@ -3645,13 +3726,14 @@ Similar to <a href="#lua_settable"><code>lua_settable</code></a>, but does a raw · 4 unmodified lines |
| 3645 | | 3726 | |
| 3646 | | 3727 | |
| 3647 | | 3728 | |
| 3648 | <hr><h3><a name="lua_rawseti"><code>lua_rawseti</code></a></h3> | 3729 | <hr><h3><a name="lua_rawseti"><code>lua_rawseti</code></a></h3><p> |
| | 3730 | <span class="apii">[-1, +0, <em>m</em>]</span> |
| 3649 | <pre>void lua_rawseti (lua_State *L, int index, int n);</pre> | 3731 | <pre>void lua_rawseti (lua_State *L, int index, int n);</pre> |
| 3650 | | 3732 | |
| 3651 | <p> | 3733 | <p> |
| 3652 | Does the equivalent of <code>t[n] = v</code>, | 3734 | Does the equivalent of <code>t[n] = v</code>, |
| 3653 | where <code>t</code> is the value at the given valid index <code>index</code> | 3735 | where <code>t</code> is the value at the given valid index |
| 3654 | and <code>v</code> is the value at the top of the stack, | 3736 | and <code>v</code> is the value at the top of the stack. |
| 3655 | | 3737 | |
| 3656 | | 3738 | |
| 3657 | <p> | 3739 | <p> |
| @@ -3684,7 +3766,8 @@ The reader function may return pieces of any size greater than zero. · 26 unmodified lines |
| 3684 | | 3766 | |
| 3685 | | 3767 | |
| 3686 | | 3768 | |
| 3687 | <hr><h3><a name="lua_register"><code>lua_register</code></a></h3> | 3769 | <hr><h3><a name="lua_register"><code>lua_register</code></a></h3><p> |
| | 3770 | <span class="apii">[-0, +0, <em>m</em>]</span> |
| 3688 | <pre>void lua_register (lua_State *L, | 3771 | <pre>void lua_register (lua_State *L, |
| 3689 | const char *name, | 3772 | const char *name, |
| 3690 | lua_CFunction f);</pre> | 3773 | lua_CFunction f);</pre> |
| @@ -3701,7 +3784,8 @@ It is defined as a macro: · 10 unmodified lines |
| 3701 | | 3784 | |
| 3702 | | 3785 | |
| 3703 | | 3786 | |
| 3704 | <hr><h3><a name="lua_remove"><code>lua_remove</code></a></h3> | 3787 | <hr><h3><a name="lua_remove"><code>lua_remove</code></a></h3><p> |
| | 3788 | <span class="apii">[-1, +0, <em>-</em>]</span> |
| 3705 | <pre>void lua_remove (lua_State *L, int index);</pre> | 3789 | <pre>void lua_remove (lua_State *L, int index);</pre> |
| 3706 | | 3790 | |
| 3707 | <p> | 3791 | <p> |
| @@ -3714,7 +3798,8 @@ because a pseudo-index is not an actual stack position. · 6 unmodified lines |
| 3714 | | 3798 | |
| 3715 | | 3799 | |
| 3716 | | 3800 | |
| 3717 | <hr><h3><a name="lua_replace"><code>lua_replace</code></a></h3> | 3801 | <hr><h3><a name="lua_replace"><code>lua_replace</code></a></h3><p> |
| | 3802 | <span class="apii">[-1, +0, <em>-</em>]</span> |
| 3718 | <pre>void lua_replace (lua_State *L, int index);</pre> | 3803 | <pre>void lua_replace (lua_State *L, int index);</pre> |
| 3719 | | 3804 | |
| 3720 | <p> | 3805 | <p> |
| @@ -3726,7 +3811,8 @@ without shifting any element · 5 unmodified lines |
| 3726 | | 3811 | |
| 3727 | | 3812 | |
| 3728 | | 3813 | |
| 3729 | <hr><h3><a name="lua_resume"><code>lua_resume</code></a></h3> | 3814 | <hr><h3><a name="lua_resume"><code>lua_resume</code></a></h3><p> |
| | 3815 | <span class="apii">[-?, +?, <em>-</em>]</span> |
| 3730 | <pre>int lua_resume (lua_State *L, int narg);</pre> | 3816 | <pre>int lua_resume (lua_State *L, int narg);</pre> |
| 3731 | | 3817 | |
| 3732 | <p> | 3818 | <p> |
| @@ -3759,7 +3845,8 @@ and then call <a href="#lua_resume"><code>lua_resume</code></a>. · 26 unmodified lines |
| 3759 | | 3845 | |
| 3760 | | 3846 | |
| 3761 | | 3847 | |
| 3762 | <hr><h3><a name="lua_setallocf"><code>lua_setallocf</code></a></h3> | 3848 | <hr><h3><a name="lua_setallocf"><code>lua_setallocf</code></a></h3><p> |
| | 3849 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3763 | <pre>void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);</pre> | 3850 | <pre>void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);</pre> |
| 3764 | | 3851 | |
| 3765 | <p> | 3852 | <p> |
| @@ -3770,7 +3857,8 @@ with user data <code>ud</code>. · 4 unmodified lines |
| 3770 | | 3857 | |
| 3771 | | 3858 | |
| 3772 | | 3859 | |
| 3773 | <hr><h3><a name="lua_setfenv"><code>lua_setfenv</code></a></h3> | 3860 | <hr><h3><a name="lua_setfenv"><code>lua_setfenv</code></a></h3><p> |
| | 3861 | <span class="apii">[-1, +0, <em>-</em>]</span> |
| 3774 | <pre>int lua_setfenv (lua_State *L, int index);</pre> | 3862 | <pre>int lua_setfenv (lua_State *L, int index);</pre> |
| 3775 | | 3863 | |
| 3776 | <p> | 3864 | <p> |
| @@ -3785,13 +3873,14 @@ Otherwise it returns 1. · 8 unmodified lines |
| 3785 | | 3873 | |
| 3786 | | 3874 | |
| 3787 | | 3875 | |
| 3788 | <hr><h3><a name="lua_setfield"><code>lua_setfield</code></a></h3> | 3876 | <hr><h3><a name="lua_setfield"><code>lua_setfield</code></a></h3><p> |
| | 3877 | <span class="apii">[-1, +0, <em>e</em>]</span> |
| 3789 | <pre>void lua_setfield (lua_State *L, int index, const char *k);</pre> | 3878 | <pre>void lua_setfield (lua_State *L, int index, const char *k);</pre> |
| 3790 | | 3879 | |
| 3791 | <p> | 3880 | <p> |
| 3792 | Does the equivalent to <code>t[k] = v</code>, | 3881 | Does the equivalent to <code>t[k] = v</code>, |
| 3793 | where <code>t</code> is the value at the given valid index <code>index</code> | 3882 | where <code>t</code> is the value at the given valid index |
| 3794 | and <code>v</code> is the value at the top of the stack, | 3883 | and <code>v</code> is the value at the top of the stack. |
| 3795 | | 3884 | |
| 3796 | | 3885 | |
| 3797 | <p> | 3886 | <p> |
| @@ -3803,7 +3892,8 @@ for the "newindex" event (see <a href="#2.8">§2.8</a>). · 5 unmodified lines |
| 3803 | | 3892 | |
| 3804 | | 3893 | |
| 3805 | | 3894 | |
| 3806 | <hr><h3><a name="lua_setglobal"><code>lua_setglobal</code></a></h3> | 3895 | <hr><h3><a name="lua_setglobal"><code>lua_setglobal</code></a></h3><p> |
| | 3896 | <span class="apii">[-1, +0, <em>e</em>]</span> |
| 3807 | <pre>void lua_setglobal (lua_State *L, const char *name);</pre> | 3897 | <pre>void lua_setglobal (lua_State *L, const char *name);</pre> |
| 3808 | | 3898 | |
| 3809 | <p> | 3899 | <p> |
| @@ -3818,7 +3908,8 @@ It is defined as a macro: · 8 unmodified lines |
| 3818 | | 3908 | |
| 3819 | | 3909 | |
| 3820 | | 3910 | |
| 3821 | <hr><h3><a name="lua_setmetatable"><code>lua_setmetatable</code></a></h3> | 3911 | <hr><h3><a name="lua_setmetatable"><code>lua_setmetatable</code></a></h3><p> |
| | 3912 | <span class="apii">[-1, +0, <em>-</em>]</span> |
| 3822 | <pre>int lua_setmetatable (lua_State *L, int index);</pre> | 3913 | <pre>int lua_setmetatable (lua_State *L, int index);</pre> |
| 3823 | | 3914 | |
| 3824 | <p> | 3915 | <p> |
| @@ -3830,12 +3921,13 @@ acceptable index. · 5 unmodified lines |
| 3830 | | 3921 | |
| 3831 | | 3922 | |
| 3832 | | 3923 | |
| 3833 | <hr><h3><a name="lua_settable"><code>lua_settable</code></a></h3> | 3924 | <hr><h3><a name="lua_settable"><code>lua_settable</code></a></h3><p> |
| | 3925 | <span class="apii">[-2, +0, <em>e</em>]</span> |
| 3834 | <pre>void lua_settable (lua_State *L, int index);</pre> | 3926 | <pre>void lua_settable (lua_State *L, int index);</pre> |
| 3835 | | 3927 | |
| 3836 | <p> | 3928 | <p> |
| 3837 | Does the equivalent to <code>t[k] = v</code>, | 3929 | Does the equivalent to <code>t[k] = v</code>, |
| 3838 | where <code>t</code> is the value at the given valid index <code>index</code>, | 3930 | where <code>t</code> is the value at the given valid index, |
| 3839 | <code>v</code> is the value at the top of the stack, | 3931 | <code>v</code> is the value at the top of the stack, |
| 3840 | and <code>k</code> is the value just below the top. | 3932 | and <code>k</code> is the value just below the top. |
| 3841 | | 3933 | |
| @@ -3849,7 +3941,8 @@ for the "newindex" event (see <a href="#2.8">§2.8</a>). · 7 unmodified lines |
| 3849 | | 3941 | |
| 3850 | | 3942 | |
| 3851 | | 3943 | |
| 3852 | <hr><h3><a name="lua_settop"><code>lua_settop</code></a></h3> | 3944 | <hr><h3><a name="lua_settop"><code>lua_settop</code></a></h3><p> |
| | 3945 | <span class="apii">[-?, +?, <em>-</em>]</span> |
| 3853 | <pre>void lua_settop (lua_State *L, int index);</pre> | 3946 | <pre>void lua_settop (lua_State *L, int index);</pre> |
| 3854 | | 3947 | |
| 3855 | <p> | 3948 | <p> |
| @@ -3882,7 +3975,8 @@ which creates a Lua state from scratch. · 26 unmodified lines |
| 3882 | | 3975 | |
| 3883 | | 3976 | |
| 3884 | | 3977 | |
| 3885 | <hr><h3><a name="lua_status"><code>lua_status</code></a></h3> | 3978 | <hr><h3><a name="lua_status"><code>lua_status</code></a></h3><p> |
| | 3979 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3886 | <pre>int lua_status (lua_State *L);</pre> | 3980 | <pre>int lua_status (lua_State *L);</pre> |
| 3887 | | 3981 | |
| 3888 | <p> | 3982 | <p> |
| @@ -3898,7 +3992,8 @@ or <a name="pdf-LUA_YIELD"><code>LUA_YIELD</code></a> if the thread is suspended · 9 unmodified lines |
| 3898 | | 3992 | |
| 3899 | | 3993 | |
| 3900 | | 3994 | |
| 3901 | <hr><h3><a name="lua_toboolean"><code>lua_toboolean</code></a></h3> | 3995 | <hr><h3><a name="lua_toboolean"><code>lua_toboolean</code></a></h3><p> |
| | 3996 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3902 | <pre>int lua_toboolean (lua_State *L, int index);</pre> | 3997 | <pre>int lua_toboolean (lua_State *L, int index);</pre> |
| 3903 | | 3998 | |
| 3904 | <p> | 3999 | <p> |
| @@ -3916,7 +4011,8 @@ use <a href="#lua_isboolean"><code>lua_isboolean</code></a> to test the value's · 11 unmodified lines |
| 3916 | | 4011 | |
| 3917 | | 4012 | |
| 3918 | | 4013 | |
| 3919 | <hr><h3><a name="lua_tocfunction"><code>lua_tocfunction</code></a></h3> | 4014 | <hr><h3><a name="lua_tocfunction"><code>lua_tocfunction</code></a></h3><p> |
| | 4015 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3920 | <pre>lua_CFunction lua_tocfunction (lua_State *L, int index);</pre> | 4016 | <pre>lua_CFunction lua_tocfunction (lua_State *L, int index);</pre> |
| 3921 | | 4017 | |
| 3922 | <p> | 4018 | <p> |
| @@ -3928,8 +4024,9 @@ otherwise, returns <code>NULL</code>. · 5 unmodified lines |
| 3928 | | 4024 | |
| 3929 | | 4025 | |
| 3930 | | 4026 | |
| 3931 | <hr><h3><a name="lua_tointeger"><code>lua_tointeger</code></a></h3> | 4027 | <hr><h3><a name="lua_tointeger"><code>lua_tointeger</code></a></h3><p> |
| 3932 | <pre>lua_Integer lua_tointeger (lua_State *L, int idx);</pre> | 4028 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| | 4029 | <pre>lua_Integer lua_tointeger (lua_State *L, int index);</pre> |
| 3933 | | 4030 | |
| 3934 | <p> | 4031 | <p> |
| 3935 | Converts the Lua value at the given acceptable index | 4032 | Converts the Lua value at the given acceptable index |
| @@ -3947,7 +4044,8 @@ it is truncated in some non-specified way. · 11 unmodified lines |
| 3947 | | 4044 | |
| 3948 | | 4045 | |
| 3949 | | 4046 | |
| 3950 | <hr><h3><a name="lua_tolstring"><code>lua_tolstring</code></a></h3> | 4047 | <hr><h3><a name="lua_tolstring"><code>lua_tolstring</code></a></h3><p> |
| | 4048 | <span class="apii">[-0, +0, <em>m</em>]</span> |
| 3951 | <pre>const char *lua_tolstring (lua_State *L, int index, size_t *len);</pre> | 4049 | <pre>const char *lua_tolstring (lua_State *L, int index, size_t *len);</pre> |
| 3952 | | 4050 | |
| 3953 | <p> | 4051 | <p> |
| @@ -3977,7 +4075,8 @@ will be valid after the corresponding value is removed from the stack. · 23 unmodified lines |
| 3977 | | 4075 | |
| 3978 | | 4076 | |
| 3979 | | 4077 | |
| 3980 | <hr><h3><a name="lua_tonumber"><code>lua_tonumber</code></a></h3> | 4078 | <hr><h3><a name="lua_tonumber"><code>lua_tonumber</code></a></h3><p> |
| | 4079 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3981 | <pre>lua_Number lua_tonumber (lua_State *L, int index);</pre> | 4080 | <pre>lua_Number lua_tonumber (lua_State *L, int index);</pre> |
| 3982 | | 4081 | |
| 3983 | <p> | 4082 | <p> |
| @@ -3991,7 +4090,8 @@ otherwise, <a href="#lua_tonumber"><code>lua_tonumber</code></a> returns 0. · 7 unmodified lines |
| 3991 | | 4090 | |
| 3992 | | 4091 | |
| 3993 | | 4092 | |
| 3994 | <hr><h3><a name="lua_topointer"><code>lua_topointer</code></a></h3> | 4093 | <hr><h3><a name="lua_topointer"><code>lua_topointer</code></a></h3><p> |
| | 4094 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 3995 | <pre>const void *lua_topointer (lua_State *L, int index);</pre> | 4095 | <pre>const void *lua_topointer (lua_State *L, int index);</pre> |
| 3996 | | 4096 | |
| 3997 | <p> | 4097 | <p> |
| @@ -4010,7 +4110,8 @@ Typically this function is used only for debug information. · 12 unmodified lines |
| 4010 | | 4110 | |
| 4011 | | 4111 | |
| 4012 | | 4112 | |
| 4013 | <hr><h3><a name="lua_tostring"><code>lua_tostring</code></a></h3> | 4113 | <hr><h3><a name="lua_tostring"><code>lua_tostring</code></a></h3><p> |
| | 4114 | <span class="apii">[-0, +0, <em>m</em>]</span> |
| 4014 | <pre>const char *lua_tostring (lua_State *L, int index);</pre> | 4115 | <pre>const char *lua_tostring (lua_State *L, int index);</pre> |
| 4015 | | 4116 | |
| 4016 | <p> | 4117 | <p> |
| @@ -4020,7 +4121,8 @@ Equivalent to <a href="#lua_tolstring"><code>lua_tolstring</code></a> with <code · 3 unmodified lines |
| 4020 | | 4121 | |
| 4021 | | 4122 | |
| 4022 | | 4123 | |
| 4023 | <hr><h3><a name="lua_tothread"><code>lua_tothread</code></a></h3> | 4124 | <hr><h3><a name="lua_tothread"><code>lua_tothread</code></a></h3><p> |
| | 4125 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 4024 | <pre>lua_State *lua_tothread (lua_State *L, int index);</pre> | 4126 | <pre>lua_State *lua_tothread (lua_State *L, int index);</pre> |
| 4025 | | 4127 | |
| 4026 | <p> | 4128 | <p> |
| @@ -4033,7 +4135,8 @@ otherwise, the function returns <code>NULL</code>. · 6 unmodified lines |
| 4033 | | 4135 | |
| 4034 | | 4136 | |
| 4035 | | 4137 | |
| 4036 | <hr><h3><a name="lua_touserdata"><code>lua_touserdata</code></a></h3> | 4138 | <hr><h3><a name="lua_touserdata"><code>lua_touserdata</code></a></h3><p> |
| | 4139 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 4037 | <pre>void *lua_touserdata (lua_State *L, int index);</pre> | 4140 | <pre>void *lua_touserdata (lua_State *L, int index);</pre> |
| 4038 | | 4141 | |
| 4039 | <p> | 4142 | <p> |
| @@ -4047,7 +4150,8 @@ Otherwise, returns <code>NULL</code>. · 7 unmodified lines |
| 4047 | | 4150 | |
| 4048 | | 4151 | |
| 4049 | | 4152 | |
| 4050 | <hr><h3><a name="lua_type"><code>lua_type</code></a></h3> | 4153 | <hr><h3><a name="lua_type"><code>lua_type</code></a></h3><p> |
| | 4154 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 4051 | <pre>int lua_type (lua_State *L, int index);</pre> | 4155 | <pre>int lua_type (lua_State *L, int index);</pre> |
| 4052 | | 4156 | |
| 4053 | <p> | 4157 | <p> |
| @@ -4071,7 +4175,8 @@ and · 17 unmodified lines |
| 4071 | | 4175 | |
| 4072 | | 4176 | |
| 4073 | | 4177 | |
| 4074 | <hr><h3><a name="lua_typename"><code>lua_typename</code></a></h3> | 4178 | <hr><h3><a name="lua_typename"><code>lua_typename</code></a></h3><p> |
| | 4179 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 4075 | <pre>const char *lua_typename (lua_State *L, int tp);</pre> | 4180 | <pre>const char *lua_typename (lua_State *L, int tp);</pre> |
| 4076 | | 4181 | |
| 4077 | <p> | 4182 | <p> |
| @@ -4089,7 +4194,7 @@ which must be one the values returned by <a href="#lua_type"><code>lua_type</cod · 11 unmodified lines |
| 4089 | void* ud);</pre> | 4194 | void* ud);</pre> |
| 4090 | | 4195 | |
| 4091 | <p> | 4196 | <p> |
| 4092 | The writer function used by <a href="#lua_dump"><code>lua_dump</code></a>. | 4197 | The type of the writer function used by <a href="#lua_dump"><code>lua_dump</code></a>. |
| 4093 | Every time it produces another piece of chunk, | 4198 | Every time it produces another piece of chunk, |
| 4094 | <a href="#lua_dump"><code>lua_dump</code></a> calls the writer, | 4199 | <a href="#lua_dump"><code>lua_dump</code></a> calls the writer, |
| 4095 | passing along the buffer to be written (<code>p</code>), | 4200 | passing along the buffer to be written (<code>p</code>), |
| @@ -4107,7 +4212,8 @@ calling the writer again. · 11 unmodified lines |
| 4107 | | 4212 | |
| 4108 | | 4213 | |
| 4109 | | 4214 | |
| 4110 | <hr><h3><a name="lua_xmove"><code>lua_xmove</code></a></h3> | 4215 | <hr><h3><a name="lua_xmove"><code>lua_xmove</code></a></h3><p> |
| | 4216 | <span class="apii">[-?, +?, <em>-</em>]</span> |
| 4111 | <pre>void lua_xmove (lua_State *from, lua_State *to, int n);</pre> | 4217 | <pre>void lua_xmove (lua_State *from, lua_State *to, int n);</pre> |
| 4112 | | 4218 | |
| 4113 | <p> | 4219 | <p> |
| @@ -4122,7 +4228,8 @@ and pushes them onto the stack <code>to</code>. · 8 unmodified lines |
| 4122 | | 4228 | |
| 4123 | | 4229 | |
| 4124 | | 4230 | |
| 4125 | <hr><h3><a name="lua_yield"><code>lua_yield</code></a></h3> | 4231 | <hr><h3><a name="lua_yield"><code>lua_yield</code></a></h3><p> |
| | 4232 | <span class="apii">[-?, +?, <em>-</em>]</span> |
| 4126 | <pre>int lua_yield (lua_State *L, int nresults);</pre> | 4233 | <pre>int lua_yield (lua_State *L, int nresults);</pre> |
| 4127 | | 4234 | |
| 4128 | <p> | 4235 | <p> |
| @@ -4254,7 +4361,8 @@ the number of upvalues of the function. · 125 unmodified lines |
| 4254 | | 4361 | |
| 4255 | | 4362 | |
| 4256 | | 4363 | |
| 4257 | <hr><h3><a name="lua_gethook"><code>lua_gethook</code></a></h3> | 4364 | <hr><h3><a name="lua_gethook"><code>lua_gethook</code></a></h3><p> |
| | 4365 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 4258 | <pre>lua_Hook lua_gethook (lua_State *L);</pre> | 4366 | <pre>lua_Hook lua_gethook (lua_State *L);</pre> |
| 4259 | | 4367 | |
| 4260 | <p> | 4368 | <p> |
| @@ -4264,7 +4372,8 @@ Returns the current hook function. · 3 unmodified lines |
| 4264 | | 4372 | |
| 4265 | | 4373 | |
| 4266 | | 4374 | |
| 4267 | <hr><h3><a name="lua_gethookcount"><code>lua_gethookcount</code></a></h3> | 4375 | <hr><h3><a name="lua_gethookcount"><code>lua_gethookcount</code></a></h3><p> |
| | 4376 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 4268 | <pre>int lua_gethookcount (lua_State *L);</pre> | 4377 | <pre>int lua_gethookcount (lua_State *L);</pre> |
| 4269 | | 4378 | |
| 4270 | <p> | 4379 | <p> |
| @@ -4274,7 +4383,8 @@ Returns the current hook count. · 3 unmodified lines |
| 4274 | | 4383 | |
| 4275 | | 4384 | |
| 4276 | | 4385 | |
| 4277 | <hr><h3><a name="lua_gethookmask"><code>lua_gethookmask</code></a></h3> | 4386 | <hr><h3><a name="lua_gethookmask"><code>lua_gethookmask</code></a></h3><p> |
| | 4387 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 4278 | <pre>int lua_gethookmask (lua_State *L);</pre> | 4388 | <pre>int lua_gethookmask (lua_State *L);</pre> |
| 4279 | | 4389 | |
| 4280 | <p> | 4390 | <p> |
| @@ -4284,7 +4394,8 @@ Returns the current hook mask. · 3 unmodified lines |
| 4284 | | 4394 | |
| 4285 | | 4395 | |
| 4286 | | 4396 | |
| 4287 | <hr><h3><a name="lua_getinfo"><code>lua_getinfo</code></a></h3> | 4397 | <hr><h3><a name="lua_getinfo"><code>lua_getinfo</code></a></h3><p> |
| | 4398 | <span class="apii">[-(0|1), +(0|1|2), <em>-</em>]</span> |
| 4288 | <pre>int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);</pre> | 4399 | <pre>int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);</pre> |
| 4289 | | 4400 | |
| 4290 | <p> | 4401 | <p> |
| @@ -4357,7 +4468,8 @@ This function returns 0 on error · 66 unmodified lines |
| 4357 | | 4468 | |
| 4358 | | 4469 | |
| 4359 | | 4470 | |
| 4360 | <hr><h3><a name="lua_getlocal"><code>lua_getlocal</code></a></h3> | 4471 | <hr><h3><a name="lua_getlocal"><code>lua_getlocal</code></a></h3><p> |
| | 4472 | <span class="apii">[-0, +(0|1), <em>-</em>]</span> |
| 4361 | <pre>const char *lua_getlocal (lua_State *L, lua_Debug *ar, int n);</pre> | 4473 | <pre>const char *lua_getlocal (lua_State *L, lua_Debug *ar, int n);</pre> |
| 4362 | | 4474 | |
| 4363 | <p> | 4475 | <p> |
| @@ -4387,7 +4499,8 @@ the number of active local variables. · 23 unmodified lines |
| 4387 | | 4499 | |
| 4388 | | 4500 | |
| 4389 | | 4501 | |
| 4390 | <hr><h3><a name="lua_getstack"><code>lua_getstack</code></a></h3> | 4502 | <hr><h3><a name="lua_getstack"><code>lua_getstack</code></a></h3><p> |
| | 4503 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 4391 | <pre>int lua_getstack (lua_State *L, int level, lua_Debug *ar);</pre> | 4504 | <pre>int lua_getstack (lua_State *L, int level, lua_Debug *ar);</pre> |
| 4392 | | 4505 | |
| 4393 | <p> | 4506 | <p> |
| @@ -4408,7 +4521,8 @@ it returns 0. · 14 unmodified lines |
| 4408 | | 4521 | |
| 4409 | | 4522 | |
| 4410 | | 4523 | |
| 4411 | <hr><h3><a name="lua_getupvalue"><code>lua_getupvalue</code></a></h3> | 4524 | <hr><h3><a name="lua_getupvalue"><code>lua_getupvalue</code></a></h3><p> |
| | 4525 | <span class="apii">[-0, +(0|1), <em>-</em>]</span> |
| 4412 | <pre>const char *lua_getupvalue (lua_State *L, int funcindex, int n);</pre> | 4526 | <pre>const char *lua_getupvalue (lua_State *L, int funcindex, int n);</pre> |
| 4413 | | 4527 | |
| 4414 | <p> | 4528 | <p> |
| @@ -4468,7 +4582,8 @@ this execution occurs without any calls to hooks. · 53 unmodified lines |
| 4468 | | 4582 | |
| 4469 | | 4583 | |
| 4470 | | 4584 | |
| 4471 | <hr><h3><a name="lua_sethook"><code>lua_sethook</code></a></h3> | 4585 | <hr><h3><a name="lua_sethook"><code>lua_sethook</code></a></h3><p> |
| | 4586 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 4472 | <pre>int lua_sethook (lua_State *L, lua_Hook f, int mask, int count);</pre> | 4587 | <pre>int lua_sethook (lua_State *L, lua_Hook f, int mask, int count);</pre> |
| 4473 | | 4588 | |
| 4474 | <p> | 4589 | <p> |
| @@ -4519,7 +4634,8 @@ A hook is disabled by setting <code>mask</code> to zero. · 44 unmodified lines |
| 4519 | | 4634 | |
| 4520 | | 4635 | |
| 4521 | | 4636 | |
| 4522 | <hr><h3><a name="lua_setlocal"><code>lua_setlocal</code></a></h3> | 4637 | <hr><h3><a name="lua_setlocal"><code>lua_setlocal</code></a></h3><p> |
| | 4638 | <span class="apii">[-(0|1), +0, <em>-</em>]</span> |
| 4523 | <pre>const char *lua_setlocal (lua_State *L, lua_Debug *ar, int n);</pre> | 4639 | <pre>const char *lua_setlocal (lua_State *L, lua_Debug *ar, int n);</pre> |
| 4524 | | 4640 | |
| 4525 | <p> | 4641 | <p> |
| @@ -4540,7 +4656,8 @@ the number of active local variables. · 14 unmodified lines |
| 4540 | | 4656 | |
| 4541 | | 4657 | |
| 4542 | | 4658 | |
| 4543 | <hr><h3><a name="lua_setupvalue"><code>lua_setupvalue</code></a></h3> | 4659 | <hr><h3><a name="lua_setupvalue"><code>lua_setupvalue</code></a></h3><p> |
| | 4660 | <span class="apii">[-(0|1), +0, <em>-</em>]</span> |
| 4544 | <pre>const char *lua_setupvalue (lua_State *L, int funcindex, int n);</pre> | 4661 | <pre>const char *lua_setupvalue (lua_State *L, int funcindex, int n);</pre> |
| 4545 | | 4662 | |
| 4546 | <p> | 4663 | <p> |
| @@ -4590,7 +4707,7 @@ and so they provide nothing that cannot be done with this API. · 43 unmodified lines |
| 4590 | Several functions in the auxiliary library are used to | 4707 | Several functions in the auxiliary library are used to |
| 4591 | check C function arguments. | 4708 | check C function arguments. |
| 4592 | Their names are always <code>luaL_check*</code> or <code>luaL_opt*</code>. | 4709 | Their names are always <code>luaL_check*</code> or <code>luaL_opt*</code>. |
| 4593 | All of these functions raise an error if the check is not satisfied. | 4710 | All of these functions throw an error if the check is not satisfied. |
| 4594 | Because the error message is formatted for arguments | 4711 | Because the error message is formatted for arguments |
| 4595 | (e.g., "<code>bad argument #1</code>"), | 4712 | (e.g., "<code>bad argument #1</code>"), |
| 4596 | you should not use these functions for other stack values. | 4713 | you should not use these functions for other stack values. |
| @@ -4605,7 +4722,8 @@ in alphabetical order. · 8 unmodified lines |
| 4605 | | 4722 | |
| 4606 | | 4723 | |
| 4607 | | 4724 | |
| 4608 | <hr><h3><a name="luaL_addchar"><code>luaL_addchar</code></a></h3> | 4725 | <hr><h3><a name="luaL_addchar"><code>luaL_addchar</code></a></h3><p> |
| | 4726 | <span class="apii">[-0, +0, <em>m</em>]</span> |
| 4609 | <pre>void luaL_addchar (luaL_Buffer *B, char c);</pre> | 4727 | <pre>void luaL_addchar (luaL_Buffer *B, char c);</pre> |
| 4610 | | 4728 | |
| 4611 | <p> | 4729 | <p> |
| @@ -4616,7 +4734,8 @@ Adds the character <code>c</code> to the buffer <code>B</code> · 4 unmodified lines |
| 4616 | | 4734 | |
| 4617 | | 4735 | |
| 4618 | | 4736 | |
| 4619 | <hr><h3><a name="luaL_addlstring"><code>luaL_addlstring</code></a></h3> | 4737 | <hr><h3><a name="luaL_addlstring"><code>luaL_addlstring</code></a></h3><p> |
| | 4738 | <span class="apii">[-0, +0, <em>m</em>]</span> |
| 4620 | <pre>void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);</pre> | 4739 | <pre>void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);</pre> |
| 4621 | | 4740 | |
| 4622 | <p> | 4741 | <p> |
| @@ -4629,7 +4748,8 @@ The string may contain embedded zeros. · 6 unmodified lines |
| 4629 | | 4748 | |
| 4630 | | 4749 | |
| 4631 | | 4750 | |
| 4632 | <hr><h3><a name="luaL_addsize"><code>luaL_addsize</code></a></h3> | 4751 | <hr><h3><a name="luaL_addsize"><code>luaL_addsize</code></a></h3><p> |
| | 4752 | <span class="apii">[-0, +0, <em>m</em>]</span> |
| 4633 | <pre>void luaL_addsize (luaL_Buffer *B, size_t n);</pre> | 4753 | <pre>void luaL_addsize (luaL_Buffer *B, size_t n);</pre> |
| 4634 | | 4754 | |
| 4635 | <p> | 4755 | <p> |
| @@ -4641,7 +4761,8 @@ buffer area (see <a href="#luaL_prepbuffer"><code>luaL_prepbuffer</code></a>). · 5 unmodified lines |
| 4641 | | 4761 | |
| 4642 | | 4762 | |
| 4643 | | 4763 | |
| 4644 | <hr><h3><a name="luaL_addstring"><code>luaL_addstring</code></a></h3> | 4764 | <hr><h3><a name="luaL_addstring"><code>luaL_addstring</code></a></h3><p> |
| | 4765 | <span class="apii">[-0, +0, <em>m</em>]</span> |
| 4645 | <pre>void luaL_addstring (luaL_Buffer *B, const char *s);</pre> | 4766 | <pre>void luaL_addstring (luaL_Buffer *B, const char *s);</pre> |
| 4646 | | 4767 | |
| 4647 | <p> | 4768 | <p> |
| @@ -4654,7 +4775,8 @@ The string may not contain embedded zeros. · 6 unmodified lines |
| 4654 | | 4775 | |
| 4655 | | 4776 | |
| 4656 | | 4777 | |
| 4657 | <hr><h3><a name="luaL_addvalue"><code>luaL_addvalue</code></a></h3> | 4778 | <hr><h3><a name="luaL_addvalue"><code>luaL_addvalue</code></a></h3><p> |
| | 4779 | <span class="apii">[-1, +0, <em>m</em>]</span> |
| 4658 | <pre>void luaL_addvalue (luaL_Buffer *B);</pre> | 4780 | <pre>void luaL_addvalue (luaL_Buffer *B);</pre> |
| 4659 | | 4781 | |
| 4660 | <p> | 4782 | <p> |
| @@ -4673,7 +4795,8 @@ which is the value to be added to the buffer. · 12 unmodified lines |
| 4673 | | 4795 | |
| 4674 | | 4796 | |
| 4675 | | 4797 | |
| 4676 | <hr><h3><a name="luaL_argcheck"><code>luaL_argcheck</code></a></h3> | 4798 | <hr><h3><a name="luaL_argcheck"><code>luaL_argcheck</code></a></h3><p> |
| | 4799 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 4677 | <pre>void luaL_argcheck (lua_State *L, | 4800 | <pre>void luaL_argcheck (lua_State *L, |
| 4678 | int cond, | 4801 | int cond, |
| 4679 | int narg, | 4802 | int narg, |
| @@ -4691,7 +4814,8 @@ where <code>func</code> is retrieved from the call stack: · 11 unmodified lines |
| 4691 | | 4814 | |
| 4692 | | 4815 | |
| 4693 | | 4816 | |
| 4694 | <hr><h3><a name="luaL_argerror"><code>luaL_argerror</code></a></h3> | 4817 | <hr><h3><a name="luaL_argerror"><code>luaL_argerror</code></a></h3><p> |
| | 4818 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 4695 | <pre>int luaL_argerror (lua_State *L, int narg, const char *extramsg);</pre> | 4819 | <pre>int luaL_argerror (lua_State *L, int narg, const char *extramsg);</pre> |
| 4696 | | 4820 | |
| 4697 | <p> | 4821 | <p> |
| @@ -4760,7 +4884,8 @@ plus the final string on its top. · 62 unmodified lines |
| 4760 | | 4884 | |
| 4761 | | 4885 | |
| 4762 | | 4886 | |
| 4763 | <hr><h3><a name="luaL_buffinit"><code>luaL_buffinit</code></a></h3> | 4887 | <hr><h3><a name="luaL_buffinit"><code>luaL_buffinit</code></a></h3><p> |
| | 4888 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 4764 | <pre>void luaL_buffinit (lua_State *L, luaL_Buffer *B);</pre> | 4889 | <pre>void luaL_buffinit (lua_State *L, luaL_Buffer *B);</pre> |
| 4765 | | 4890 | |
| 4766 | <p> | 4891 | <p> |
| @@ -4773,7 +4898,8 @@ the buffer must be declared as a variable · 6 unmodified lines |
| 4773 | | 4898 | |
| 4774 | | 4899 | |
| 4775 | | 4900 | |
| 4776 | <hr><h3><a name="luaL_callmeta"><code>luaL_callmeta</code></a></h3> | 4901 | <hr><h3><a name="luaL_callmeta"><code>luaL_callmeta</code></a></h3><p> |
| | 4902 | <span class="apii">[-0, +(0|1), <em>e</em>]</span> |
| 4777 | <pre>int luaL_callmeta (lua_State *L, int obj, const char *e);</pre> | 4903 | <pre>int luaL_callmeta (lua_State *L, int obj, const char *e);</pre> |
| 4778 | | 4904 | |
| 4779 | <p> | 4905 | <p> |
| @@ -4793,7 +4919,8 @@ this function returns 0 (without pushing any value on the stack). · 13 unmodified lines |
| 4793 | | 4919 | |
| 4794 | | 4920 | |
| 4795 | | 4921 | |
| 4796 | <hr><h3><a name="luaL_checkany"><code>luaL_checkany</code></a></h3> | 4922 | <hr><h3><a name="luaL_checkany"><code>luaL_checkany</code></a></h3><p> |
| | 4923 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 4797 | <pre>void luaL_checkany (lua_State *L, int narg);</pre> | 4924 | <pre>void luaL_checkany (lua_State *L, int narg);</pre> |
| 4798 | | 4925 | |
| 4799 | <p> | 4926 | <p> |
| @@ -4804,7 +4931,8 @@ of any type (including <b>nil</b>) at position <code>narg</code>. · 4 unmodified lines |
| 4804 | | 4931 | |
| 4805 | | 4932 | |
| 4806 | | 4933 | |
| 4807 | <hr><h3><a name="luaL_checkint"><code>luaL_checkint</code></a></h3> | 4934 | <hr><h3><a name="luaL_checkint"><code>luaL_checkint</code></a></h3><p> |
| | 4935 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 4808 | <pre>int luaL_checkint (lua_State *L, int narg);</pre> | 4936 | <pre>int luaL_checkint (lua_State *L, int narg);</pre> |
| 4809 | | 4937 | |
| 4810 | <p> | 4938 | <p> |
| @@ -4815,7 +4943,8 @@ and returns this number cast to an <code>int</code>. · 4 unmodified lines |
| 4815 | | 4943 | |
| 4816 | | 4944 | |
| 4817 | | 4945 | |
| 4818 | <hr><h3><a name="luaL_checkinteger"><code>luaL_checkinteger</code></a></h3> | 4946 | <hr><h3><a name="luaL_checkinteger"><code>luaL_checkinteger</code></a></h3><p> |
| | 4947 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 4819 | <pre>lua_Integer luaL_checkinteger (lua_State *L, int narg);</pre> | 4948 | <pre>lua_Integer luaL_checkinteger (lua_State *L, int narg);</pre> |
| 4820 | | 4949 | |
| 4821 | <p> | 4950 | <p> |
| @@ -4826,7 +4955,8 @@ and returns this number cast to a <a href="#lua_Integer"><code>lua_Integer</code · 4 unmodified lines |
| 4826 | | 4955 | |
| 4827 | | 4956 | |
| 4828 | | 4957 | |
| 4829 | <hr><h3><a name="luaL_checklong"><code>luaL_checklong</code></a></h3> | 4958 | <hr><h3><a name="luaL_checklong"><code>luaL_checklong</code></a></h3><p> |
| | 4959 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 4830 | <pre>long luaL_checklong (lua_State *L, int narg);</pre> | 4960 | <pre>long luaL_checklong (lua_State *L, int narg);</pre> |
| 4831 | | 4961 | |
| 4832 | <p> | 4962 | <p> |
| @@ -4837,7 +4967,8 @@ and returns this number cast to a <code>long</code>. · 4 unmodified lines |
| 4837 | | 4967 | |
| 4838 | | 4968 | |
| 4839 | | 4969 | |
| 4840 | <hr><h3><a name="luaL_checklstring"><code>luaL_checklstring</code></a></h3> | 4970 | <hr><h3><a name="luaL_checklstring"><code>luaL_checklstring</code></a></h3><p> |
| | 4971 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 4841 | <pre>const char *luaL_checklstring (lua_State *L, int narg, size_t *l);</pre> | 4972 | <pre>const char *luaL_checklstring (lua_State *L, int narg, size_t *l);</pre> |
| 4842 | | 4973 | |
| 4843 | <p> | 4974 | <p> |
| @@ -4847,10 +4978,16 @@ if <code>l</code> is not <code>NULL</code> fills <code>*l</code> · 3 unmodified lines |
| 4847 | with the string's length. | 4978 | with the string's length. |
| 4848 | | 4979 | |
| 4849 | | 4980 | |
| | 4981 | <p> |
| | 4982 | This function uses <a href="#lua_tolstring"><code>lua_tolstring</code></a> to get its result, |
| | 4983 | so all conversions and caveats of that function apply here. |
| 4850 | | 4984 | |
| 4851 | | 4985 | |
| 4852 | | 4986 | |
| 4853 | <hr><h3><a name="luaL_checknumber"><code>luaL_checknumber</code></a></h3> | 4987 | |
| | 4988 | |
| | 4989 | <hr><h3><a name="luaL_checknumber"><code>luaL_checknumber</code></a></h3><p> |
| | 4990 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 4854 | <pre>lua_Number luaL_checknumber (lua_State *L, int narg);</pre> | 4991 | <pre>lua_Number luaL_checknumber (lua_State *L, int narg);</pre> |
| 4855 | | 4992 | |
| 4856 | <p> | 4993 | <p> |
| @@ -4861,7 +4998,8 @@ and returns this number. · 4 unmodified lines |
| 4861 | | 4998 | |
| 4862 | | 4999 | |
| 4863 | | 5000 | |
| 4864 | <hr><h3><a name="luaL_checkoption"><code>luaL_checkoption</code></a></h3> | 5001 | <hr><h3><a name="luaL_checkoption"><code>luaL_checkoption</code></a></h3><p> |
| | 5002 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 4865 | <pre>int luaL_checkoption (lua_State *L, | 5003 | <pre>int luaL_checkoption (lua_State *L, |
| 4866 | int narg, | 5004 | int narg, |
| 4867 | const char *def, | 5005 | const char *def, |
| @@ -4891,7 +5029,8 @@ to use strings instead of numbers to select options.) · 23 unmodified lines |
| 4891 | | 5029 | |
| 4892 | | 5030 | |
| 4893 | | 5031 | |
| 4894 | <hr><h3><a name="luaL_checkstack"><code>luaL_checkstack</code></a></h3> | 5032 | <hr><h3><a name="luaL_checkstack"><code>luaL_checkstack</code></a></h3><p> |
| | 5033 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 4895 | <pre>void luaL_checkstack (lua_State *L, int sz, const char *msg);</pre> | 5034 | <pre>void luaL_checkstack (lua_State *L, int sz, const char *msg);</pre> |
| 4896 | | 5035 | |
| 4897 | <p> | 5036 | <p> |
| @@ -4903,7 +5042,8 @@ raising an error if the stack cannot grow to that size. · 5 unmodified lines |
| 4903 | | 5042 | |
| 4904 | | 5043 | |
| 4905 | | 5044 | |
| 4906 | <hr><h3><a name="luaL_checkstring"><code>luaL_checkstring</code></a></h3> | 5045 | <hr><h3><a name="luaL_checkstring"><code>luaL_checkstring</code></a></h3><p> |
| | 5046 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 4907 | <pre>const char *luaL_checkstring (lua_State *L, int narg);</pre> | 5047 | <pre>const char *luaL_checkstring (lua_State *L, int narg);</pre> |
| 4908 | | 5048 | |
| 4909 | <p> | 5049 | <p> |
| @@ -4911,20 +5051,28 @@ Checks whether the function argument <code>narg</code> is a string · 1 unmodified line |
| 4911 | and returns this string. | 5051 | and returns this string. |
| 4912 | | 5052 | |
| 4913 | | 5053 | |
| | 5054 | <p> |
| | 5055 | This function uses <a href="#lua_tolstring"><code>lua_tolstring</code></a> to get its result, |
| | 5056 | so all conversions and caveats of that function apply here. |
| | 5057 | |
| | 5058 | |
| 4914 | | 5059 | |
| 4915 | | 5060 | |
| 4916 | | 5061 | |
| 4917 | <hr><h3><a name="luaL_checktype"><code>luaL_checktype</code></a></h3> | 5062 | <hr><h3><a name="luaL_checktype"><code>luaL_checktype</code></a></h3><p> |
| | 5063 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 4918 | <pre>void luaL_checktype (lua_State *L, int narg, int t);</pre> | 5064 | <pre>void luaL_checktype (lua_State *L, int narg, int t);</pre> |
| 4919 | | 5065 | |
| 4920 | <p> | 5066 | <p> |
| 4921 | Checks whether the function argument <code>narg</code> has type <code>t</code>. | 5067 | Checks whether the function argument <code>narg</code> has type <code>t</code>. |
| | 5068 | See <a href="#lua_type"><code>lua_type</code></a> for the encoding of types for <code>t</code>. |
| 4922 | | 5069 | |
| 4923 | | 5070 | |
| 4924 | | 5071 | |
| 4925 | | 5072 | |
| 4926 | | 5073 | |
| 4927 | <hr><h3><a name="luaL_checkudata"><code>luaL_checkudata</code></a></h3> | 5074 | <hr><h3><a name="luaL_checkudata"><code>luaL_checkudata</code></a></h3><p> |
| | 5075 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 4928 | <pre>void *luaL_checkudata (lua_State *L, int narg, const char *tname);</pre> | 5076 | <pre>void *luaL_checkudata (lua_State *L, int narg, const char *tname);</pre> |
| 4929 | | 5077 | |
| 4930 | <p> | 5078 | <p> |
| @@ -4935,7 +5083,8 @@ of the type <code>tname</code> (see <a href="#luaL_newmetatable"><code>luaL_newm · 4 unmodified lines |
| 4935 | | 5083 | |
| 4936 | | 5084 | |
| 4937 | | 5085 | |
| 4938 | <hr><h3><a name="luaL_dofile"><code>luaL_dofile</code></a></h3> | 5086 | <hr><h3><a name="luaL_dofile"><code>luaL_dofile</code></a></h3><p> |
| | 5087 | <span class="apii">[-0, +?, <em>m</em>]</span> |
| 4939 | <pre>int luaL_dofile (lua_State *L, const char *filename);</pre> | 5088 | <pre>int luaL_dofile (lua_State *L, const char *filename);</pre> |
| 4940 | | 5089 | |
| 4941 | <p> | 5090 | <p> |
| @@ -4952,7 +5101,8 @@ or 1 in case of errors. · 10 unmodified lines |
| 4952 | | 5101 | |
| 4953 | | 5102 | |
| 4954 | | 5103 | |
| 4955 | <hr><h3><a name="luaL_dostring"><code>luaL_dostring</code></a></h3> | 5104 | <hr><h3><a name="luaL_dostring"><code>luaL_dostring</code></a></h3><p> |
| | 5105 | <span class="apii">[-0, +?, <em>m</em>]</span> |
| 4956 | <pre>int luaL_dostring (lua_State *L, const char *str);</pre> | 5106 | <pre>int luaL_dostring (lua_State *L, const char *str);</pre> |
| 4957 | | 5107 | |
| 4958 | <p> | 5108 | <p> |
| @@ -4969,7 +5119,8 @@ or 1 in case of errors. · 10 unmodified lines |
| 4969 | | 5119 | |
| 4970 | | 5120 | |
| 4971 | | 5121 | |
| 4972 | <hr><h3><a name="luaL_error"><code>luaL_error</code></a></h3> | 5122 | <hr><h3><a name="luaL_error"><code>luaL_error</code></a></h3><p> |
| | 5123 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 4973 | <pre>int luaL_error (lua_State *L, const char *fmt, ...);</pre> | 5124 | <pre>int luaL_error (lua_State *L, const char *fmt, ...);</pre> |
| 4974 | | 5125 | |
| 4975 | <p> | 5126 | <p> |
| @@ -4991,7 +5142,8 @@ as <code>return luaL_error(<em>args</em>)</code>. · 15 unmodified lines |
| 4991 | | 5142 | |
| 4992 | | 5143 | |
| 4993 | | 5144 | |
| 4994 | <hr><h3><a name="luaL_getmetafield"><code>luaL_getmetafield</code></a></h3> | 5145 | <hr><h3><a name="luaL_getmetafield"><code>luaL_getmetafield</code></a></h3><p> |
| | 5146 | <span class="apii">[-0, +(0|1), <em>m</em>]</span> |
| 4995 | <pre>int luaL_getmetafield (lua_State *L, int obj, const char *e);</pre> | 5147 | <pre>int luaL_getmetafield (lua_State *L, int obj, const char *e);</pre> |
| 4996 | | 5148 | |
| 4997 | <p> | 5149 | <p> |
| @@ -5005,7 +5157,8 @@ returns 0 and pushes nothing. · 7 unmodified lines |
| 5005 | | 5157 | |
| 5006 | | 5158 | |
| 5007 | | 5159 | |
| 5008 | <hr><h3><a name="luaL_getmetatable"><code>luaL_getmetatable</code></a></h3> | 5160 | <hr><h3><a name="luaL_getmetatable"><code>luaL_getmetatable</code></a></h3><p> |
| | 5161 | <span class="apii">[-0, +1, <em>-</em>]</span> |
| 5009 | <pre>void luaL_getmetatable (lua_State *L, const char *tname);</pre> | 5162 | <pre>void luaL_getmetatable (lua_State *L, const char *tname);</pre> |
| 5010 | | 5163 | |
| 5011 | <p> | 5164 | <p> |
| @@ -5016,7 +5169,8 @@ in the registry (see <a href="#luaL_newmetatable"><code>luaL_newmetatable</code> · 4 unmodified lines |
| 5016 | | 5169 | |
| 5017 | | 5170 | |
| 5018 | | 5171 | |
| 5019 | <hr><h3><a name="luaL_gsub"><code>luaL_gsub</code></a></h3> | 5172 | <hr><h3><a name="luaL_gsub"><code>luaL_gsub</code></a></h3><p> |
| | 5173 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 5020 | <pre>const char *luaL_gsub (lua_State *L, | 5174 | <pre>const char *luaL_gsub (lua_State *L, |
| 5021 | const char *s, | 5175 | const char *s, |
| 5022 | const char *p, | 5176 | const char *p, |
| @@ -5032,7 +5186,8 @@ Pushes the resulting string on the stack and returns it. · 9 unmodified lines |
| 5032 | | 5186 | |
| 5033 | | 5187 | |
| 5034 | | 5188 | |
| 5035 | <hr><h3><a name="luaL_loadbuffer"><code>luaL_loadbuffer</code></a></h3> | 5189 | <hr><h3><a name="luaL_loadbuffer"><code>luaL_loadbuffer</code></a></h3><p> |
| | 5190 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 5036 | <pre>int luaL_loadbuffer (lua_State *L, | 5191 | <pre>int luaL_loadbuffer (lua_State *L, |
| 5037 | const char *buff, | 5192 | const char *buff, |
| 5038 | size_t sz, | 5193 | size_t sz, |
| @@ -5053,7 +5208,8 @@ used for debug information and error messages. · 14 unmodified lines |
| 5053 | | 5208 | |
| 5054 | | 5209 | |
| 5055 | | 5210 | |
| 5056 | <hr><h3><a name="luaL_loadfile"><code>luaL_loadfile</code></a></h3> | 5211 | <hr><h3><a name="luaL_loadfile"><code>luaL_loadfile</code></a></h3><p> |
| | 5212 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 5057 | <pre>int luaL_loadfile (lua_State *L, const char *filename);</pre> | 5213 | <pre>int luaL_loadfile (lua_State *L, const char *filename);</pre> |
| 5058 | | 5214 | |
| 5059 | <p> | 5215 | <p> |
| @@ -5079,7 +5235,8 @@ it does not run it. · 19 unmodified lines |
| 5079 | | 5235 | |
| 5080 | | 5236 | |
| 5081 | | 5237 | |
| 5082 | <hr><h3><a name="luaL_loadstring"><code>luaL_loadstring</code></a></h3> | 5238 | <hr><h3><a name="luaL_loadstring"><code>luaL_loadstring</code></a></h3><p> |
| | 5239 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 5083 | <pre>int luaL_loadstring (lua_State *L, const char *s);</pre> | 5240 | <pre>int luaL_loadstring (lua_State *L, const char *s);</pre> |
| 5084 | | 5241 | |
| 5085 | <p> | 5242 | <p> |
| @@ -5100,7 +5257,8 @@ it does not run it. · 14 unmodified lines |
| 5100 | | 5257 | |
| 5101 | | 5258 | |
| 5102 | | 5259 | |
| 5103 | <hr><h3><a name="luaL_newmetatable"><code>luaL_newmetatable</code></a></h3> | 5260 | <hr><h3><a name="luaL_newmetatable"><code>luaL_newmetatable</code></a></h3><p> |
| | 5261 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 5104 | <pre>int luaL_newmetatable (lua_State *L, const char *tname);</pre> | 5262 | <pre>int luaL_newmetatable (lua_State *L, const char *tname);</pre> |
| 5105 | | 5263 | |
| 5106 | <p> | 5264 | <p> |
| @@ -5120,7 +5278,8 @@ with <code>tname</code> in the registry. · 13 unmodified lines |
| 5120 | | 5278 | |
| 5121 | | 5279 | |
| 5122 | | 5280 | |
| 5123 | <hr><h3><a name="luaL_newstate"><code>luaL_newstate</code></a></h3> | 5281 | <hr><h3><a name="luaL_newstate"><code>luaL_newstate</code></a></h3><p> |
| | 5282 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 5124 | <pre>lua_State *luaL_newstate (void);</pre> | 5283 | <pre>lua_State *luaL_newstate (void);</pre> |
| 5125 | | 5284 | |
| 5126 | <p> | 5285 | <p> |
| @@ -5140,7 +5299,8 @@ or <code>NULL</code> if there is a memory allocation error. · 13 unmodified lines |
| 5140 | | 5299 | |
| 5141 | | 5300 | |
| 5142 | | 5301 | |
| 5143 | <hr><h3><a name="luaL_openlibs"><code>luaL_openlibs</code></a></h3> | 5302 | <hr><h3><a name="luaL_openlibs"><code>luaL_openlibs</code></a></h3><p> |
| | 5303 | <span class="apii">[-0, +0, <em>m</em>]</span> |
| 5144 | <pre>void luaL_openlibs (lua_State *L);</pre> | 5304 | <pre>void luaL_openlibs (lua_State *L);</pre> |
| 5145 | | 5305 | |
| 5146 | <p> | 5306 | <p> |
| @@ -5150,7 +5310,8 @@ Opens all standard Lua libraries into the given state. · 3 unmodified lines |
| 5150 | | 5310 | |
| 5151 | | 5311 | |
| 5152 | | 5312 | |
| 5153 | <hr><h3><a name="luaL_optint"><code>luaL_optint</code></a></h3> | 5313 | <hr><h3><a name="luaL_optint"><code>luaL_optint</code></a></h3><p> |
| | 5314 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 5154 | <pre>int luaL_optint (lua_State *L, int narg, int d);</pre> | 5315 | <pre>int luaL_optint (lua_State *L, int narg, int d);</pre> |
| 5155 | | 5316 | |
| 5156 | <p> | 5317 | <p> |
| @@ -5164,7 +5325,8 @@ Otherwise, raises an error. · 7 unmodified lines |
| 5164 | | 5325 | |
| 5165 | | 5326 | |
| 5166 | | 5327 | |
| 5167 | <hr><h3><a name="luaL_optinteger"><code>luaL_optinteger</code></a></h3> | 5328 | <hr><h3><a name="luaL_optinteger"><code>luaL_optinteger</code></a></h3><p> |
| | 5329 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 5168 | <pre>lua_Integer luaL_optinteger (lua_State *L, | 5330 | <pre>lua_Integer luaL_optinteger (lua_State *L, |
| 5169 | int narg, | 5331 | int narg, |
| 5170 | lua_Integer d);</pre> | 5332 | lua_Integer d);</pre> |
| @@ -5180,7 +5342,8 @@ Otherwise, raises an error. · 9 unmodified lines |
| 5180 | | 5342 | |
| 5181 | | 5343 | |
| 5182 | | 5344 | |
| 5183 | <hr><h3><a name="luaL_optlong"><code>luaL_optlong</code></a></h3> | 5345 | <hr><h3><a name="luaL_optlong"><code>luaL_optlong</code></a></h3><p> |
| | 5346 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 5184 | <pre>long luaL_optlong (lua_State *L, int narg, long d);</pre> | 5347 | <pre>long luaL_optlong (lua_State *L, int narg, long d);</pre> |
| 5185 | | 5348 | |
| 5186 | <p> | 5349 | <p> |
| @@ -5194,7 +5357,8 @@ Otherwise, raises an error. · 7 unmodified lines |
| 5194 | | 5357 | |
| 5195 | | 5358 | |
| 5196 | | 5359 | |
| 5197 | <hr><h3><a name="luaL_optlstring"><code>luaL_optlstring</code></a></h3> | 5360 | <hr><h3><a name="luaL_optlstring"><code>luaL_optlstring</code></a></h3><p> |
| | 5361 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 5198 | <pre>const char *luaL_optlstring (lua_State *L, | 5362 | <pre>const char *luaL_optlstring (lua_State *L, |
| 5199 | int narg, | 5363 | int narg, |
| 5200 | const char *d, | 5364 | const char *d, |
| @@ -5216,7 +5380,8 @@ fills the position <code>*l</code> with the results's length. · 15 unmodified lines |
| 5216 | | 5380 | |
| 5217 | | 5381 | |
| 5218 | | 5382 | |
| 5219 | <hr><h3><a name="luaL_optnumber"><code>luaL_optnumber</code></a></h3> | 5383 | <hr><h3><a name="luaL_optnumber"><code>luaL_optnumber</code></a></h3><p> |
| | 5384 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 5220 | <pre>lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number d);</pre> | 5385 | <pre>lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number d);</pre> |
| 5221 | | 5386 | |
| 5222 | <p> | 5387 | <p> |
| @@ -5230,7 +5395,8 @@ Otherwise, raises an error. · 7 unmodified lines |
| 5230 | | 5395 | |
| 5231 | | 5396 | |
| 5232 | | 5397 | |
| 5233 | <hr><h3><a name="luaL_optstring"><code>luaL_optstring</code></a></h3> | 5398 | <hr><h3><a name="luaL_optstring"><code>luaL_optstring</code></a></h3><p> |
| | 5399 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 5234 | <pre>const char *luaL_optstring (lua_State *L, | 5400 | <pre>const char *luaL_optstring (lua_State *L, |
| 5235 | int narg, | 5401 | int narg, |
| 5236 | const char *d);</pre> | 5402 | const char *d);</pre> |
| @@ -5246,7 +5412,8 @@ Otherwise, raises an error. · 9 unmodified lines |
| 5246 | | 5412 | |
| 5247 | | 5413 | |
| 5248 | | 5414 | |
| 5249 | <hr><h3><a name="luaL_prepbuffer"><code>luaL_prepbuffer</code></a></h3> | 5415 | <hr><h3><a name="luaL_prepbuffer"><code>luaL_prepbuffer</code></a></h3><p> |
| | 5416 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 5250 | <pre>char *luaL_prepbuffer (luaL_Buffer *B);</pre> | 5417 | <pre>char *luaL_prepbuffer (luaL_Buffer *B);</pre> |
| 5251 | | 5418 | |
| 5252 | <p> | 5419 | <p> |
| @@ -5261,7 +5428,8 @@ it to the buffer. · 8 unmodified lines |
| 5261 | | 5428 | |
| 5262 | | 5429 | |
| 5263 | | 5430 | |
| 5264 | <hr><h3><a name="luaL_pushresult"><code>luaL_pushresult</code></a></h3> | 5431 | <hr><h3><a name="luaL_pushresult"><code>luaL_pushresult</code></a></h3><p> |
| | 5432 | <span class="apii">[-?, +1, <em>m</em>]</span> |
| 5265 | <pre>void luaL_pushresult (luaL_Buffer *B);</pre> | 5433 | <pre>void luaL_pushresult (luaL_Buffer *B);</pre> |
| 5266 | | 5434 | |
| 5267 | <p> | 5435 | <p> |
| @@ -5272,7 +5440,8 @@ the top of the stack. · 4 unmodified lines |
| 5272 | | 5440 | |
| 5273 | | 5441 | |
| 5274 | | 5442 | |
| 5275 | <hr><h3><a name="luaL_ref"><code>luaL_ref</code></a></h3> | 5443 | <hr><h3><a name="luaL_ref"><code>luaL_ref</code></a></h3><p> |
| | 5444 | <span class="apii">[-1, +0, <em>m</em>]</span> |
| 5276 | <pre>int luaL_ref (lua_State *L, int t);</pre> | 5445 | <pre>int luaL_ref (lua_State *L, int t);</pre> |
| 5277 | | 5446 | |
| 5278 | <p> | 5447 | <p> |
| @@ -5318,7 +5487,8 @@ in which both <code>name</code> and <code>func</code> are <code>NULL</code>. · 39 unmodified lines |
| 5318 | | 5487 | |
| 5319 | | 5488 | |
| 5320 | | 5489 | |
| 5321 | <hr><h3><a name="luaL_register"><code>luaL_register</code></a></h3> | 5490 | <hr><h3><a name="luaL_register"><code>luaL_register</code></a></h3><p> |
| | 5491 | <span class="apii">[-(0|1), +1, <em>m</em>]</span> |
| 5322 | <pre>void luaL_register (lua_State *L, | 5492 | <pre>void luaL_register (lua_State *L, |
| 5323 | const char *libname, | 5493 | const char *libname, |
| 5324 | const luaL_Reg *l);</pre> | 5494 | const luaL_Reg *l);</pre> |
| @@ -5352,17 +5522,19 @@ on the top of the stack. · 27 unmodified lines |
| 5352 | | 5522 | |
| 5353 | | 5523 | |
| 5354 | | 5524 | |
| 5355 | <hr><h3><a name="luaL_typename"><code>luaL_typename</code></a></h3> | 5525 | <hr><h3><a name="luaL_typename"><code>luaL_typename</code></a></h3><p> |
| 5356 | <pre>const char *luaL_typename (lua_State *L, int idx);</pre> | 5526 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| | 5527 | <pre>const char *luaL_typename (lua_State *L, int index);</pre> |
| 5357 | | 5528 | |
| 5358 | <p> | 5529 | <p> |
| 5359 | Returns the name of the type of the value at index <code>idx</code>. | 5530 | Returns the name of the type of the value at the given index. |
| 5360 | | 5531 | |
| 5361 | | 5532 | |
| 5362 | | 5533 | |
| 5363 | | 5534 | |
| 5364 | | 5535 | |
| 5365 | <hr><h3><a name="luaL_typerror"><code>luaL_typerror</code></a></h3> | 5536 | <hr><h3><a name="luaL_typerror"><code>luaL_typerror</code></a></h3><p> |
| | 5537 | <span class="apii">[-0, +0, <em>v</em>]</span> |
| 5366 | <pre>int luaL_typerror (lua_State *L, int narg, const char *tname);</pre> | 5538 | <pre>int luaL_typerror (lua_State *L, int narg, const char *tname);</pre> |
| 5367 | | 5539 | |
| 5368 | <p> | 5540 | <p> |
| @@ -5379,7 +5551,8 @@ and <code><em>rt</em></code> is the type name of the actual argument. · 10 unmodified lines |
| 5379 | | 5551 | |
| 5380 | | 5552 | |
| 5381 | | 5553 | |
| 5382 | <hr><h3><a name="luaL_unref"><code>luaL_unref</code></a></h3> | 5554 | <hr><h3><a name="luaL_unref"><code>luaL_unref</code></a></h3><p> |
| | 5555 | <span class="apii">[-0, +0, <em>-</em>]</span> |
| 5383 | <pre>void luaL_unref (lua_State *L, int t, int ref);</pre> | 5556 | <pre>void luaL_unref (lua_State *L, int t, int ref);</pre> |
| 5384 | | 5557 | |
| 5385 | <p> | 5558 | <p> |
| @@ -5398,7 +5571,8 @@ If <code>ref</code> is <a href="#pdf-LUA_NOREF"><code>LUA_NOREF</code></a> or <a · 12 unmodified lines |
| 5398 | | 5571 | |
| 5399 | | 5572 | |
| 5400 | | 5573 | |
| 5401 | <hr><h3><a name="luaL_where"><code>luaL_where</code></a></h3> | 5574 | <hr><h3><a name="luaL_where"><code>luaL_where</code></a></h3><p> |
| | 5575 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 5402 | <pre>void luaL_where (lua_State *L, int lvl);</pre> | 5576 | <pre>void luaL_where (lua_State *L, int lvl);</pre> |
| 5403 | | 5577 | |
| 5404 | <p> | 5578 | <p> |
| @@ -5433,7 +5607,7 @@ Some of these functions provide essential services to the language · 28 unmodified lines |
| 5433 | others provide access to "outside" services (e.g., I/O); | 5607 | others provide access to "outside" services (e.g., I/O); |
| 5434 | and others could be implemented in Lua itself, | 5608 | and others could be implemented in Lua itself, |
| 5435 | but are quite useful or have critical performance requirements that | 5609 | but are quite useful or have critical performance requirements that |
| 5436 | deserve an implementation in C (e.g., <code>sort</code>). | 5610 | deserve an implementation in C (e.g., <a href="#pdf-table.sort"><code>table.sort</code></a>). |
| 5437 | | 5611 | |
| 5438 | | 5612 | |
| 5439 | <p> | 5613 | <p> |
| @@ -5476,7 +5650,8 @@ it can open them individually by calling · 36 unmodified lines |
| 5476 | <a name="pdf-luaopen_string"><code>luaopen_string</code></a> (for the string library), | 5650 | <a name="pdf-luaopen_string"><code>luaopen_string</code></a> (for the string library), |
| 5477 | <a name="pdf-luaopen_table"><code>luaopen_table</code></a> (for the table library), | 5651 | <a name="pdf-luaopen_table"><code>luaopen_table</code></a> (for the table library), |
| 5478 | <a name="pdf-luaopen_math"><code>luaopen_math</code></a> (for the mathematical library), | 5652 | <a name="pdf-luaopen_math"><code>luaopen_math</code></a> (for the mathematical library), |
| 5479 | <a name="pdf-luaopen_io"><code>luaopen_io</code></a> (for the I/O and the Operating System libraries), | 5653 | <a name="pdf-luaopen_io"><code>luaopen_io</code></a> (for the I/O library), |
| | 5654 | <a name="pdf-luaopen_os"><code>luaopen_os</code></a> (for the Operating System library), |
| 5480 | and <a name="pdf-luaopen_debug"><code>luaopen_debug</code></a> (for the debug library). | 5655 | and <a name="pdf-luaopen_debug"><code>luaopen_debug</code></a> (for the debug library). |
| 5481 | These functions are declared in <a name="pdf-lualib.h"><code>lualib.h</code></a> | 5656 | These functions are declared in <a name="pdf-lualib.h"><code>lualib.h</code></a> |
| 5482 | and should not be called directly: | 5657 | and should not be called directly: |
| @@ -5665,6 +5840,8 @@ The environment of the returned function is the global environment. · 182 unmodified lines |
| 5665 | <p> | 5840 | <p> |
| 5666 | <code>chunkname</code> is used as the chunk name for error messages | 5841 | <code>chunkname</code> is used as the chunk name for error messages |
| 5667 | and debug information. | 5842 | and debug information. |
| | 5843 | When absent, |
| | 5844 | it defaults to "<code>=(load)</code>". |
| 5668 | | 5845 | |
| 5669 | | 5846 | |
| 5670 | | 5847 | |
| @@ -5698,6 +5875,11 @@ To load and run a given string, use the idiom · 27 unmodified lines |
| 5698 | assert(loadstring(s))() | 5875 | assert(loadstring(s))() |
| 5699 | </pre> | 5876 | </pre> |
| 5700 | | 5877 | |
| | 5878 | <p> |
| | 5879 | When absent, |
| | 5880 | <code>chunkname</code> defaults to the given string. |
| | 5881 | |
| | 5882 | |
| 5701 | | 5883 | |
| 5702 | | 5884 | |
| 5703 | <p> | 5885 | <p> |
| @@ -6160,7 +6342,15 @@ Otherwise, it tries to find a <em>loader</em> for the module. · 456 unmodified lines |
| 6160 | | 6342 | |
| 6161 | <p> | 6343 | <p> |
| 6162 | To find a loader, | 6344 | To find a loader, |
| 6163 | first <code>require</code> queries <code>package.preload[modname]</code>. | 6345 | <code>require</code> is guided by the <a href="#pdf-package.loaders"><code>package.loaders</code></a> array. |
| | 6346 | By changing this array, |
| | 6347 | we can change how <code>require</code> looks for a module. |
| | 6348 | The following explanation is based on the default configuration |
| | 6349 | for <a href="#pdf-package.loaders"><code>package.loaders</code></a>. |
| | 6350 | |
| | 6351 | |
| | 6352 | <p> |
| | 6353 | First <code>require</code> queries <code>package.preload[modname]</code>. |
| 6164 | If it has a value, | 6354 | If it has a value, |
| 6165 | this value (which should be a function) is the loader. | 6355 | this value (which should be a function) is the loader. |
| 6166 | Otherwise <code>require</code> searches for a Lua loader using the | 6356 | Otherwise <code>require</code> searches for a Lua loader using the |
| @@ -6168,38 +6358,7 @@ path stored in <a href="#pdf-package.path"><code>package.path</code></a>. · 1 unmodified line |
| 6168 | If that also fails, it searches for a C loader using the | 6358 | If that also fails, it searches for a C loader using the |
| 6169 | path stored in <a href="#pdf-package.cpath"><code>package.cpath</code></a>. | 6359 | path stored in <a href="#pdf-package.cpath"><code>package.cpath</code></a>. |
| 6170 | If that also fails, | 6360 | If that also fails, |
| 6171 | it tries an <em>all-in-one</em> loader (see below). | 6361 | it tries an <em>all-in-one</em> loader (see <a href="#pdf-package.loaders"><code>package.loaders</code></a>). |
| 6172 | | | |
| 6173 | | | |
| 6174 | <p> | | |
| 6175 | When loading a C library, | | |
| 6176 | <code>require</code> first uses a dynamic link facility to link the | | |
| 6177 | application with the library. | | |
| 6178 | Then it tries to find a C function inside this library to | | |
| 6179 | be used as the loader. | | |
| 6180 | The name of this C function is the string "<code>luaopen_</code>" | | |
| 6181 | concatenated with a copy of the module name where each dot | | |
| 6182 | is replaced by an underscore. | | |
| 6183 | Moreover, if the module name has a hyphen, | | |
| 6184 | its prefix up to (and including) the first hyphen is removed. | | |
| 6185 | For instance, if the module name is <code>a.v1-b.c</code>, | | |
| 6186 | the function name will be <code>luaopen_b_c</code>. | | |
| 6187 | | | |
| 6188 | | | |
| 6189 | <p> | | |
| 6190 | If <code>require</code> finds neither a Lua library nor a | | |
| 6191 | C library for a module, | | |
| 6192 | it calls the <em>all-in-one loader</em>. | | |
| 6193 | This loader searches the C path for a library for | | |
| 6194 | the root name of the given module. | | |
| 6195 | For instance, when requiring <code>a.b.c</code>, | | |
| 6196 | it will search for a C library for <code>a</code>. | | |
| 6197 | If found, it looks into it for an open function for | | |
| 6198 | the submodule; | | |
| 6199 | in our example, that would be <code>luaopen_a_b_c</code>. | | |
| 6200 | With this facility, a package can pack several C submodules | | |
| 6201 | into one single library, | | |
| 6202 | with each submodule keeping its original open function. | | |
| 6203 | | 6362 | |
| 6204 | | 6363 | |
| 6205 | <p> | 6364 | <p> |
| @@ -6234,7 +6393,7 @@ The path used by <a href="#pdf-require"><code>require</code></a> to search for a · 28 unmodified lines |
| 6234 | Lua initializes the C path <a href="#pdf-package.cpath"><code>package.cpath</code></a> in the same way | 6393 | Lua initializes the C path <a href="#pdf-package.cpath"><code>package.cpath</code></a> in the same way |
| 6235 | it initializes the Lua path <a href="#pdf-package.path"><code>package.path</code></a>, | 6394 | it initializes the Lua path <a href="#pdf-package.path"><code>package.path</code></a>, |
| 6236 | using the environment variable <a name="pdf-LUA_CPATH"><code>LUA_CPATH</code></a> | 6395 | using the environment variable <a name="pdf-LUA_CPATH"><code>LUA_CPATH</code></a> |
| 6237 | (plus another default path defined in <code>luaconf.h</code>). | 6396 | or a default path defined in <code>luaconf.h</code>. |
| 6238 | | 6397 | |
| 6239 | | 6398 | |
| 6240 | | 6399 | |
| @@ -6254,6 +6413,94 @@ When you require a module <code>modname</code> and · 13 unmodified lines |
| 6254 | | 6413 | |
| 6255 | | 6414 | |
| 6256 | | 6415 | |
| | 6416 | <p> |
| | 6417 | <hr><h3><a name="pdf-package.loaders"><code>package.loaders</code></a></h3> |
| | 6418 | |
| | 6419 | |
| | 6420 | <p> |
| | 6421 | A table used by <a href="#pdf-require"><code>require</code></a> to control how to load modules. |
| | 6422 | |
| | 6423 | |
| | 6424 | <p> |
| | 6425 | Each entry in this table is a <em>searcher function</em>. |
| | 6426 | When looking for a module, |
| | 6427 | <a href="#pdf-require"><code>require</code></a> calls each of these searchers in ascending order, |
| | 6428 | with the module name (the argument given to <a href="#pdf-require"><code>require</code></a>) as its |
| | 6429 | sole parameter. |
| | 6430 | The function may return another function (the module <em>loader</em>) |
| | 6431 | or a string explaining why it did not find that module |
| | 6432 | (or <b>nil</b> if it has nothing to say). |
| | 6433 | Lua initializes this table with four functions. |
| | 6434 | |
| | 6435 | |
| | 6436 | <p> |
| | 6437 | The first searcher simply looks for a loader in the |
| | 6438 | <a href="#pdf-package.preload"><code>package.preload</code></a> table. |
| | 6439 | |
| | 6440 | |
| | 6441 | <p> |
| | 6442 | The second searcher looks for a loader as a Lua library, |
| | 6443 | using the path stored at <a href="#pdf-package.path"><code>package.path</code></a>. |
| | 6444 | A path is a sequence of <em>templates</em> separated by semicolons. |
| | 6445 | For each template, |
| | 6446 | the searcher will change each interrogation |
| | 6447 | mark in the template by <code>filename</code>, |
| | 6448 | which is the module name with each dot replaced by a |
| | 6449 | "directory separator" (such as "<code>/</code>" in Unix); |
| | 6450 | then it will try to open the resulting file name. |
| | 6451 | So, for instance, if the Lua path is the string |
| | 6452 | |
| | 6453 | <pre> |
| | 6454 | "./?.lua;./?.lc;/usr/local/?/init.lua" |
| | 6455 | </pre><p> |
| | 6456 | the search for a Lua file for module <code>foo</code> |
| | 6457 | will try to open the files |
| | 6458 | <code>./foo.lua</code>, <code>./foo.lc</code>, and |
| | 6459 | <code>/usr/local/foo/init.lua</code>, in that order. |
| | 6460 | |
| | 6461 | |
| | 6462 | <p> |
| | 6463 | The third searcher looks for a loader as a C library, |
| | 6464 | using the path given by the variable <a href="#pdf-package.cpath"><code>package.cpath</code></a>. |
| | 6465 | For instance, |
| | 6466 | if the C path is the string |
| | 6467 | |
| | 6468 | <pre> |
| | 6469 | "./?.so;./?.dll;/usr/local/?/init.so" |
| | 6470 | </pre><p> |
| | 6471 | the searcher for module <code>foo</code> |
| | 6472 | will try to open the files <code>./foo.so</code>, <code>./foo.dll</code>, |
| | 6473 | and <code>/usr/local/foo/init.so</code>, in that order. |
| | 6474 | Once it finds a C library, |
| | 6475 | this searcher first uses a dynamic link facility to link the |
| | 6476 | application with the library. |
| | 6477 | Then it tries to find a C function inside the library to |
| | 6478 | be used as the loader. |
| | 6479 | The name of this C function is the string "<code>luaopen_</code>" |
| | 6480 | concatenated with a copy of the module name where each dot |
| | 6481 | is replaced by an underscore. |
| | 6482 | Moreover, if the module name has a hyphen, |
| | 6483 | its prefix up to (and including) the first hyphen is removed. |
| | 6484 | For instance, if the module name is <code>a.v1-b.c</code>, |
| | 6485 | the function name will be <code>luaopen_b_c</code>. |
| | 6486 | |
| | 6487 | |
| | 6488 | <p> |
| | 6489 | The fourth searcher tries an <em>all-in-one loader</em>. |
| | 6490 | It searches the C path for a library for |
| | 6491 | the root name of the given module. |
| | 6492 | For instance, when requiring <code>a.b.c</code>, |
| | 6493 | it will search for a C library for <code>a</code>. |
| | 6494 | If found, it looks into it for an open function for |
| | 6495 | the submodule; |
| | 6496 | in our example, that would be <code>luaopen_a_b_c</code>. |
| | 6497 | With this facility, a package can pack several C submodules |
| | 6498 | into one single library, |
| | 6499 | with each submodule keeping its original open function. |
| | 6500 | |
| | 6501 | |
| | 6502 | |
| | 6503 | |
| 6257 | <p> | 6504 | <p> |
| 6258 | <hr><h3><a name="pdf-package.loadlib"><code>package.loadlib (libname, funcname)</code></a></h3> | 6505 | <hr><h3><a name="pdf-package.loadlib"><code>package.loadlib (libname, funcname)</code></a></h3> |
| 6259 | | 6506 | |
| @@ -6303,24 +6550,6 @@ Any "<code>;;</code>" in the value of the environment variable · 43 unmodified lines |
| 6303 | is replaced by the default path. | 6550 | is replaced by the default path. |
| 6304 | | 6551 | |
| 6305 | | 6552 | |
| 6306 | <p> | | |
| 6307 | A path is a sequence of <em>templates</em> separated by semicolons. | | |
| 6308 | For each template, <a href="#pdf-require"><code>require</code></a> will change each interrogation | | |
| 6309 | mark in the template by <code>filename</code>, | | |
| 6310 | which is <code>modname</code> with each dot replaced by a | | |
| 6311 | "directory separator" (such as "<code>/</code>" in Unix); | | |
| 6312 | then it will try to load the resulting file name. | | |
| 6313 | So, for instance, if the Lua path is | | |
| 6314 | | | |
| 6315 | <pre> | | |
| 6316 | "./?.lua;./?.lc;/usr/local/?/init.lua" | | |
| 6317 | </pre><p> | | |
| 6318 | the search for a Lua loader for module <code>foo</code> | | |
| 6319 | will try to load the files | | |
| 6320 | <code>./foo.lua</code>, <code>./foo.lc</code>, and | | |
| 6321 | <code>/usr/local/foo/init.lua</code>, in that order. | | |
| 6322 | | | |
| 6323 | | | |
| 6324 | | 6553 | |
| 6325 | | 6554 | |
| 6326 | <p> | 6555 | <p> |
| @@ -6524,11 +6753,12 @@ work as an anchor, as this would prevent the iteration. · 197 unmodified lines |
| 6524 | <p> | 6753 | <p> |
| 6525 | <hr><h3><a name="pdf-string.gsub"><code>string.gsub (s, pattern, repl [, n])</code></a></h3> | 6754 | <hr><h3><a name="pdf-string.gsub"><code>string.gsub (s, pattern, repl [, n])</code></a></h3> |
| 6526 | Returns a copy of <code>s</code> | 6755 | Returns a copy of <code>s</code> |
| 6527 | in which all occurrences of the <code>pattern</code> have been | 6756 | in which all (or the first <code>n</code>, if given) |
| | 6757 | occurrences of the <code>pattern</code> have been |
| 6528 | replaced by a replacement string specified by <code>repl</code>, | 6758 | replaced by a replacement string specified by <code>repl</code>, |
| 6529 | which may be a string, a table, or a function. | 6759 | which may be a string, a table, or a function. |
| 6530 | <code>gsub</code> also returns, as its second value, | 6760 | <code>gsub</code> also returns, as its second value, |
| 6531 | the total number of substitutions made. | 6761 | the total number of matches that occurred. |
| 6532 | | 6762 | |
| 6533 | | 6763 | |
| 6534 | <p> | 6764 | <p> |
| @@ -6565,13 +6795,6 @@ then there is no replacement · 30 unmodified lines |
| 6565 | (that is, the original match is kept in the string). | 6795 | (that is, the original match is kept in the string). |
| 6566 | | 6796 | |
| 6567 | | 6797 | |
| 6568 | <p> | | |
| 6569 | The optional last parameter <code>n</code> limits | | |
| 6570 | the maximum number of substitutions to occur. | | |
| 6571 | For instance, when <code>n</code> is 1 only the first occurrence of | | |
| 6572 | <code>pattern</code> is replaced. | | |
| 6573 | | | |
| 6574 | | | |
| 6575 | <p> | 6798 | <p> |
| 6576 | Here are some examples: | 6799 | Here are some examples: |
| 6577 | | 6800 | |
| @@ -7005,14 +7228,14 @@ Returns the arc tangent of <code>x</code> (in radians). · 427 unmodified lines |
| 7005 | | 7228 | |
| 7006 | | 7229 | |
| 7007 | <p> | 7230 | <p> |
| 7008 | <hr><h3><a name="pdf-math.atan2"><code>math.atan2 (x, y)</code></a></h3> | 7231 | <hr><h3><a name="pdf-math.atan2"><code>math.atan2 (y, x)</code></a></h3> |
| 7009 | | 7232 | |
| 7010 | | 7233 | |
| 7011 | <p> | 7234 | <p> |
| 7012 | Returns the arc tangent of <code>x/y</code> (in radians), | 7235 | Returns the arc tangent of <code>y/x</code> (in radians), |
| 7013 | but uses the signs of both parameters to find the | 7236 | but uses the signs of both parameters to find the |
| 7014 | quadrant of the result. | 7237 | quadrant of the result. |
| 7015 | (It also handles correctly the case of <code>y</code> being zero.) | 7238 | (It also handles correctly the case of <code>x</code> being zero.) |
| 7016 | | 7239 | |
| 7017 | | 7240 | |
| 7018 | | 7241 | |
| @@ -7062,7 +7285,7 @@ Returns the angle <code>x</code> (given in radians) in degrees. · 43 unmodified lines |
| 7062 | | 7285 | |
| 7063 | | 7286 | |
| 7064 | <p> | 7287 | <p> |
| 7065 | Returns the the value <em>e<sup>x</sup></em>. | 7288 | Returns the value <em>e<sup>x</sup></em>. |
| 7066 | | 7289 | |
| 7067 | | 7290 | |
| 7068 | | 7291 | |
| @@ -7215,13 +7438,13 @@ pseudo-random generator function <code>rand</code> provided by ANSI C. · 146 unmodified lines |
| 7215 | | 7438 | |
| 7216 | <p> | 7439 | <p> |
| 7217 | When called without arguments, | 7440 | When called without arguments, |
| 7218 | returns a pseudo-random real number | 7441 | returns a uniform pseudo-random real number |
| 7219 | in the range <em>[0,1)</em>. | 7442 | in the range <em>[0,1)</em>. |
| 7220 | When called with a number <code>m</code>, | 7443 | When called with an integer number <code>m</code>, |
| 7221 | <code>math.random</code> returns | 7444 | <code>math.random</code> returns |
| 7222 | a pseudo-random integer in the range <em>[1, m]</em>. | 7445 | a uniform pseudo-random integer in the range <em>[1, m]</em>. |
| 7223 | When called with two numbers <code>m</code> and <code>n</code>, | 7446 | When called with two integer numbers <code>m</code> and <code>n</code>, |
| 7224 | <code>math.random</code> returns a pseudo-random | 7447 | <code>math.random</code> returns a uniform pseudo-random |
| 7225 | integer in the range <em>[m, n]</em>. | 7448 | integer in the range <em>[m, n]</em>. |
| 7226 | | 7449 | |
| 7227 | | 7450 | |
| @@ -7316,6 +7539,7 @@ and then all operations are supplied as methods of the file descriptor. · 88 unmodified lines |
| 7316 | The table <code>io</code> also provides | 7539 | The table <code>io</code> also provides |
| 7317 | three predefined file descriptors with their usual meanings from C: | 7540 | three predefined file descriptors with their usual meanings from C: |
| 7318 | <a name="pdf-io.stdin"><code>io.stdin</code></a>, <a name="pdf-io.stdout"><code>io.stdout</code></a>, and <a name="pdf-io.stderr"><code>io.stderr</code></a>. | 7541 | <a name="pdf-io.stdin"><code>io.stdin</code></a>, <a name="pdf-io.stdout"><code>io.stdout</code></a>, and <a name="pdf-io.stderr"><code>io.stderr</code></a>. |
| | 7542 | The I/O library never closes these files. |
| 7319 | | 7543 | |
| 7320 | | 7544 | |
| 7321 | <p> | 7545 | <p> |
| @@ -7829,9 +8053,9 @@ or <b>nil</b> if the request cannot be honored. · 507 unmodified lines |
| 7829 | | 8053 | |
| 7830 | <p> | 8054 | <p> |
| 7831 | If <code>locale</code> is the empty string, | 8055 | If <code>locale</code> is the empty string, |
| 7832 | the current locate is set to an implementation-defined native locale. | 8056 | the current locale is set to an implementation-defined native locale. |
| 7833 | If <code>locate</code> is the string "<code>C</code>", | 8057 | If <code>locale</code> is the string "<code>C</code>", |
| 7834 | the current locate is set to the standard C locale. | 8058 | the current locale is set to the standard C locale. |
| 7835 | | 8059 | |
| 7836 | | 8060 | |
| 7837 | <p> | 8061 | <p> |
| @@ -7892,7 +8116,7 @@ and similar tasks, such as profiling. · 54 unmodified lines |
| 7892 | Please resist the temptation to use them as a | 8116 | Please resist the temptation to use them as a |
| 7893 | usual programming tool: | 8117 | usual programming tool: |
| 7894 | they can be very slow. | 8118 | they can be very slow. |
| 7895 | Moreover, several of its functions | 8119 | Moreover, several of these functions |
| 7896 | violate some assumptions about Lua code | 8120 | violate some assumptions about Lua code |
| 7897 | (e.g., that variables local to a function | 8121 | (e.g., that variables local to a function |
| 7898 | cannot be accessed from outside or | 8122 | cannot be accessed from outside or |
| @@ -7983,7 +8207,8 @@ valid lines. · 84 unmodified lines |
| 7983 | | 8207 | |
| 7984 | <p> | 8208 | <p> |
| 7985 | For instance, the expression <code>debug.getinfo(1,"n").name</code> returns | 8209 | For instance, the expression <code>debug.getinfo(1,"n").name</code> returns |
| 7986 | a name of the current function, if a reasonable name can be found, | 8210 | a table with a name for the current function, |
| | 8211 | if a reasonable name can be found, |
| 7987 | and the expression <code>debug.getinfo(print)</code> | 8212 | and the expression <code>debug.getinfo(print)</code> |
| 7988 | returns a table with all available information | 8213 | returns a table with all available information |
| 7989 | about the <a href="#pdf-print"><code>print</code></a> function. | 8214 | about the <a href="#pdf-print"><code>print</code></a> function. |
| @@ -8070,9 +8295,9 @@ The string mask may have the following characters, · 80 unmodified lines |
| 8070 | with the given meaning: | 8295 | with the given meaning: |
| 8071 | | 8296 | |
| 8072 | <ul> | 8297 | <ul> |
| 8073 | <li><b><code>"c"</code>:</b> The hook is called every time Lua calls a function;</li> | 8298 | <li><b><code>"c"</code>:</b> the hook is called every time Lua calls a function;</li> |
| 8074 | <li><b><code>"r"</code>:</b> The hook is called every time Lua returns from a function;</li> | 8299 | <li><b><code>"r"</code>:</b> the hook is called every time Lua returns from a function;</li> |
| 8075 | <li><b><code>"l"</code>:</b> The hook is called every time Lua enters a new line of code.</li> | 8300 | <li><b><code>"l"</code>:</b> the hook is called every time Lua enters a new line of code.</li> |
| 8076 | </ul><p> | 8301 | </ul><p> |
| 8077 | With a <code>count</code> different from zero, | 8302 | With a <code>count</code> different from zero, |
| 8078 | the hook is called after every <code>count</code> instructions. | 8303 | the hook is called after every <code>count</code> instructions. |
| @@ -8257,17 +8482,19 @@ then its value is used as the prompt. · 178 unmodified lines |
| 8257 | Similarly, if the global variable <a name="pdf-_PROMPT2"><code>_PROMPT2</code></a> contains a string, | 8482 | Similarly, if the global variable <a name="pdf-_PROMPT2"><code>_PROMPT2</code></a> contains a string, |
| 8258 | its value is used as the secondary prompt | 8483 | its value is used as the secondary prompt |
| 8259 | (issued during incomplete statements). | 8484 | (issued during incomplete statements). |
| 8260 | Therefore, both prompts can be changed directly on the command line. | 8485 | Therefore, both prompts can be changed directly on the command line |
| 8261 | For instance, | 8486 | or in any Lua programs by assigning to <code>_PROMPT</code>. |
| | 8487 | See the next example: |
| 8262 | | 8488 | |
| 8263 | <pre> | 8489 | <pre> |
| 8264 | $ lua -e"_PROMPT='myprompt> '" -i | 8490 | $ lua -e"_PROMPT='myprompt> '" -i |
| 8265 | </pre><p> | 8491 | </pre><p> |
| 8266 | (the outer pair of quotes is for the shell, | 8492 | (The outer pair of quotes is for the shell, |
| 8267 | the inner pair is for Lua), | 8493 | the inner pair is for Lua.) |
| 8268 | or in any Lua programs by assigning to <code>_PROMPT</code>. | 8494 | Note the use of <code>-i</code> to enter interactive mode; |
| 8269 | Note the use of <code>-i</code> to enter interactive mode; otherwise, | 8495 | otherwise, |
| 8270 | the program would just end silently right after the assignment to <code>_PROMPT</code>. | 8496 | the program would just end silently |
| | 8497 | right after the assignment to <code>_PROMPT</code>. |
| 8271 | | 8498 | |
| 8272 | | 8499 | |
| 8273 | <p> | 8500 | <p> |
| @@ -8297,7 +8524,7 @@ is a more portable solution.) · 23 unmodified lines |
| 8297 | <h1>7 - <a name="7">Incompatibilities with the Previous Version</a></h1> | 8524 | <h1>7 - <a name="7">Incompatibilities with the Previous Version</a></h1> |
| 8298 | | 8525 | |
| 8299 | <p> | 8526 | <p> |
| 8300 | Here we list the incompatibilities that you may found when moving a program | 8527 | Here we list the incompatibilities that you may find when moving a program |
| 8301 | from Lua 5.0 to Lua 5.1. | 8528 | from Lua 5.0 to Lua 5.1. |
| 8302 | You can avoid most of the incompatibilities compiling Lua with | 8529 | You can avoid most of the incompatibilities compiling Lua with |
| 8303 | appropriate options (see file <code>luaconf.h</code>). | 8530 | appropriate options (see file <code>luaconf.h</code>). |
| @@ -8446,29 +8673,29 @@ Here is the complete syntax of Lua in extended BNF. · 142 unmodified lines |
| 8446 | | 8673 | |
| 8447 | block ::= chunk | 8674 | block ::= chunk |
| 8448 | | 8675 | |
| 8449 | stat ::= varlist1 `<b>=</b>´ explist1 | | 8676 | stat ::= varlist `<b>=</b>´ explist | |
| 8450 | functioncall | | 8677 | functioncall | |
| 8451 | <b>do</b> block <b>end</b> | | 8678 | <b>do</b> block <b>end</b> | |
| 8452 | <b>while</b> exp <b>do</b> block <b>end</b> | | 8679 | <b>while</b> exp <b>do</b> block <b>end</b> | |
| 8453 | <b>repeat</b> block <b>until</b> exp | | 8680 | <b>repeat</b> block <b>until</b> exp | |
| 8454 | <b>if</b> exp <b>then</b> block {<b>elseif</b> exp <b>then</b> block} [<b>else</b> block] <b>end</b> | | 8681 | <b>if</b> exp <b>then</b> block {<b>elseif</b> exp <b>then</b> block} [<b>else</b> block] <b>end</b> | |
| 8455 | <b>for</b> Name `<b>=</b>´ exp `<b>,</b>´ exp [`<b>,</b>´ exp] <b>do</b> block <b>end</b> | | 8682 | <b>for</b> Name `<b>=</b>´ exp `<b>,</b>´ exp [`<b>,</b>´ exp] <b>do</b> block <b>end</b> | |
| 8456 | <b>for</b> namelist <b>in</b> explist1 <b>do</b> block <b>end</b> | | 8683 | <b>for</b> namelist <b>in</b> explist <b>do</b> block <b>end</b> | |
| 8457 | <b>function</b> funcname funcbody | | 8684 | <b>function</b> funcname funcbody | |
| 8458 | <b>local</b> <b>function</b> Name funcbody | | 8685 | <b>local</b> <b>function</b> Name funcbody | |
| 8459 | <b>local</b> namelist [`<b>=</b>´ explist1] | 8686 | <b>local</b> namelist [`<b>=</b>´ explist] |
| 8460 | | 8687 | |
| 8461 | laststat ::= <b>return</b> [explist1] | <b>break</b> | 8688 | laststat ::= <b>return</b> [explist] | <b>break</b> |
| 8462 | | 8689 | |
| 8463 | funcname ::= Name {`<b>.</b>´ Name} [`<b>:</b>´ Name] | 8690 | funcname ::= Name {`<b>.</b>´ Name} [`<b>:</b>´ Name] |
| 8464 | | 8691 | |
| 8465 | varlist1 ::= var {`<b>,</b>´ var} | 8692 | varlist ::= var {`<b>,</b>´ var} |
| 8466 | | 8693 | |
| 8467 | var ::= Name | prefixexp `<b>[</b>´ exp `<b>]</b>´ | prefixexp `<b>.</b>´ Name | 8694 | var ::= Name | prefixexp `<b>[</b>´ exp `<b>]</b>´ | prefixexp `<b>.</b>´ Name |
| 8468 | | 8695 | |
| 8469 | namelist ::= Name {`<b>,</b>´ Name} | 8696 | namelist ::= Name {`<b>,</b>´ Name} |
| 8470 | | 8697 | |
| 8471 | explist1 ::= {exp `<b>,</b>´} exp | 8698 | explist ::= {exp `<b>,</b>´} exp |
| 8472 | | 8699 | |
| 8473 | exp ::= <b>nil</b> | <b>false</b> | <b>true</b> | Number | String | `<b>...</b>´ | function | | 8700 | exp ::= <b>nil</b> | <b>false</b> | <b>true</b> | Number | String | `<b>...</b>´ | function | |
| 8474 | prefixexp | tableconstructor | exp binop exp | unop exp | 8701 | prefixexp | tableconstructor | exp binop exp | unop exp |
| @@ -8477,13 +8704,13 @@ Here is the complete syntax of Lua in extended BNF. · 2 unmodified lines |
| 8477 | | 8704 | |
| 8478 | functioncall ::= prefixexp args | prefixexp `<b>:</b>´ Name args | 8705 | functioncall ::= prefixexp args | prefixexp `<b>:</b>´ Name args |
| 8479 | | 8706 | |
| 8480 | args ::= `<b>(</b>´ [explist1] `<b>)</b>´ | tableconstructor | String | 8707 | args ::= `<b>(</b>´ [explist] `<b>)</b>´ | tableconstructor | String |
| 8481 | | 8708 | |
| 8482 | function ::= <b>function</b> funcbody | 8709 | function ::= <b>function</b> funcbody |
| 8483 | | 8710 | |
| 8484 | funcbody ::= `<b>(</b>´ [parlist1] `<b>)</b>´ block <b>end</b> | 8711 | funcbody ::= `<b>(</b>´ [parlist] `<b>)</b>´ block <b>end</b> |
| 8485 | | 8712 | |
| 8486 | parlist1 ::= namelist [`<b>,</b>´ `<b>...</b>´] | `<b>...</b>´ | 8713 | parlist ::= namelist [`<b>,</b>´ `<b>...</b>´] | `<b>...</b>´ |
| 8487 | | 8714 | |
| 8488 | tableconstructor ::= `<b>{</b>´ [fieldlist] `<b>}</b>´ | 8715 | tableconstructor ::= `<b>{</b>´ [fieldlist] `<b>}</b>´ |
| 8489 | | 8716 | |
| @@ -8508,13 +8735,14 @@ Here is the complete syntax of Lua in extended BNF. · 18 unmodified lines |
| 8508 | | 8735 | |
| 8509 | | 8736 | |
| 8510 | | 8737 | |
| | 8738 | |
| 8511 | <HR> | 8739 | <HR> |
| 8512 | <SMALL> | 8740 | <SMALL> |
| 8513 | Last update: | 8741 | Last update: |
| 8514 | Mon Mar 26 12:59:26 BRT 2007 | 8742 | Thu Jan 17 15:06:18 BRST 2008 |
| 8515 | </SMALL> | 8743 | </SMALL> |
| 8516 | <!-- | 8744 | <!-- |
| 8517 | Last change: ready for Lua 5.1.2 | 8745 | Last change: revised for Lua 5.1.3 |
| 8518 | --> | 8746 | --> |
| 8519 | | 8747 | |
| 8520 | </body></html> | 8748 | </body></html> |