@@ -664,15 +664,13 @@ Values equal to or less than 100 mean the collector will not wait to
664664start a new cycle.
665665A value of 200 means that the collector waits for
666666the total number of objects to double before starting a new cycle.
667- The default value is 200.
668667
669668The garbage-collector step size controls the
670669size of each incremental step,
671670specifically how many objects the interpreter creates
672671before performing a step:
673672A value of @M{n} means the interpreter will create
674673approximately @M{n} objects between steps.
675- The default value is 250.
676674
677675The garbage-collector step multiplier
678676controls the size of each GC step.
@@ -681,7 +679,6 @@ in each step, @M{n%} objects for each created object.
681679Larger values make the collector more aggressive.
682680Beware that values too small can
683681make the collector too slow to ever finish a cycle.
684- The default value is 200.
685682As a special case, a zero value means unlimited work,
686683effectively producing a non-incremental, stop-the-world collector.
687684
@@ -711,7 +708,6 @@ after the last major collection.
711708For instance, for a multiplier of 20,
712709the collector will do a minor collection when the number of objects
713710gets 20% larger than the total after the last major collection.
714- The default value is 25.
715711
716712The minor-major multiplier controls the shift to major collections.
717713For a multiplier @M{x},
@@ -721,7 +717,6 @@ than the total after the previous major collection.
721717For instance, for a multiplier of 100,
722718the collector will do a major collection when the number of old objects
723719gets larger than twice the total after the previous major collection.
724- The default value is 100.
725720
726721The major-minor multiplier controls the shift back to minor collections.
727722For a multiplier @M{x},
@@ -731,7 +726,6 @@ of the objects allocated during the last cycle.
731726In particular, for a multiplier of 0,
732727the collector will immediately shift back to minor collections
733728after doing one cycle of major collections.
734- The default value is 50.
735729
736730}
737731
@@ -5885,13 +5879,6 @@ or @id{NULL} if there is a @x{memory allocation error}.
58855879
58865880}
58875881
5888- @APIEntry{void luaL_openlibs (lua_State *L);|
5889- @apii{0,0,e}
5890-
5891- Opens all standard Lua libraries into the given state.
5892-
5893- }
5894-
58955882@APIEntry{
58965883T luaL_opt (L, func, arg, dflt);|
58975884@apii{0,0,-}
@@ -6073,7 +6060,7 @@ and sets the call result to @T{package.loaded[modname]},
60736060as if that function has been called through @Lid{require}.
60746061
60756062If @id{glb} is true,
6076- also stores the module into the global @id{modname}.
6063+ also stores the module into the global variable @id{modname}.
60776064
60786065Leaves a copy of the module on the stack.
60796066
@@ -6290,23 +6277,61 @@ Except for the basic and the package libraries,
62906277each library provides all its functions as fields of a global table
62916278or as methods of its objects.
62926279
6293- To have access to these libraries,
6294- the @N{C host} program should call the @Lid{luaL_openlibs} function,
6295- which opens all standard libraries.
6280+ }
6281+
6282+
6283+ @sect2{lualib-h| @title{Loading the Libraries in C code}
6284+
6285+ A @N{C host} program must explicitly load
6286+ the standard libraries into a state,
6287+ if it wants its scripts to use them.
6288+ For that,
6289+ the host program can call the function @Lid{luaL_openlibs}.
62966290Alternatively,
6297- the host program can open them individually by using
6298- @Lid{luaL_requiref} to call
6299- @defid{luaopen_base} (for the basic library),
6300- @defid{luaopen_package} (for the package library),
6301- @defid{luaopen_coroutine} (for the coroutine library),
6302- @defid{luaopen_string} (for the string library),
6303- @defid{luaopen_utf8} (for the UTF-8 library),
6304- @defid{luaopen_table} (for the table library),
6305- @defid{luaopen_math} (for the mathematical library),
6306- @defid{luaopen_io} (for the I/O library),
6307- @defid{luaopen_os} (for the operating system library),
6308- and @defid{luaopen_debug} (for the debug library).
6309- These functions are declared in @defid{lualib.h}.
6291+ the host can select which libraries to open,
6292+ by using @Lid{luaL_openselectedlibs}.
6293+ Both functions are defined in the header file @id{lualib.h}.
6294+ @index{lualib.h}
6295+
6296+ The stand-alone interpreter @id{lua} @see{lua-sa}
6297+ already opens all standard libraries.
6298+
6299+ @APIEntry{void luaL_openlibs (lua_State *L);|
6300+ @apii{0,0,e}
6301+
6302+ Opens all standard Lua libraries into the given state.
6303+
6304+ }
6305+
6306+ @APIEntry{void luaL_openselectedlibs (lua_State *L, int load, int preload);|
6307+ @apii{0,0,e}
6308+
6309+ Opens (loads) and preloads selected libraries into the state @id{L}.
6310+ (To @emph{preload} means to add
6311+ the library loader into the table @Lid{package.preload},
6312+ so that the library can be required later by the program.
6313+ Keep in mind that @Lid{require} itself is provided
6314+ by the @emph{package} library.
6315+ If a program does not load that library,
6316+ it will be unable to require anything.)
6317+
6318+ The integer @id{load} selects which libraries to load;
6319+ the integer @id{preload} selects which to preload, among those not loaded.
6320+ Both are masks formed by a bitwise OR of the following constants:
6321+ @description{
6322+ @item{@defid{LUA_GLIBK} | the basic library.}
6323+ @item{@defid{LUA_LOADLIBK} | the package library.}
6324+ @item{@defid{LUA_COLIBK} | the coroutine library.}
6325+ @item{@defid{LUA_STRLIBK} | the string library.}
6326+ @item{@defid{LUA_UTF8LIBK} | the UTF-8 library.}
6327+ @item{@defid{LUA_TABLIBK} | the table library.}
6328+ @item{@defid{LUA_MATHLIBK} | the mathematical library.}
6329+ @item{@defid{LUA_IOLIBK} | the I/O library.}
6330+ @item{@defid{LUA_OSLIBK} | the operating system library.}
6331+ @item{@defid{LUA_DBLIBK} | the debug library.}
6332+ }
6333+
6334+ }
63106335
63116336}
63126337
0 commit comments