@@ -60,7 +60,6 @@ macro_rules! lua_macros {
6060// Loading functions
6161dyn_symbols ! {
6262 /// Function used by [luaL_loadbuffer].
63- ///
6463 pub extern "C" fn luaL_loadbufferx(
6564 l: LuaState ,
6665 code: LuaString ,
@@ -249,11 +248,11 @@ dyn_symbols! {
249248 // Type conversion getters
250249
251250 /// Converts the Lua value at the given index to a C string.
252- /// If len is not 0 , it also sets *len with the string length.
251+ /// If len is not None , it also sets *len with the string length.
253252 /// The Lua value must be a string or a number; otherwise, the function returns a [None].
254253 /// If the value is a number, then lua_tolstring also changes the actual value in the stack to a string.
255254 /// (This change confuses lua_next when lua_tolstring is applied to keys during a table traversal.)
256- pub extern "C" fn lua_tolstring( l: LuaState , ind: c_int, size : SizeT ) -> Option <LuaString >;
255+ pub extern "C" fn lua_tolstring( l: LuaState , ind: c_int, len : Option < * mut SizeT > ) -> Option <LuaString >;
257256
258257 /// Converts the Lua value at the given acceptable index to a C boolean value (0 or 1).
259258 /// Like all tests in Lua, lua_toboolean returns 1 for any Lua value different from false and nil; otherwise returning 0.
@@ -358,8 +357,8 @@ dyn_symbols! {
358357 pub extern "C" fn luaL_checknumber( l: LuaState , narg: c_int) -> LuaNumber ;
359358
360359 /// Checks whether the function argument ``narg`` is a string and returns this string.
361- /// If len is not 0 fills *len with the string's length.
362- pub extern "C" fn luaL_checklstring( l: LuaState , narg: c_int, len: SizeT ) -> LuaString ;
360+ /// If len is not None fills *len with the string's length.
361+ pub extern "C" fn luaL_checklstring( l: LuaState , narg: c_int, len: Option < * mut SizeT > ) -> LuaString ;
363362
364363 /// Checks whether the function has an argument of any type (including nil) at position narg.
365364 pub extern "C" fn luaL_checkany( l: LuaState , narg: c_int) -> ( ) ;
@@ -568,15 +567,15 @@ dyn_symbols! {
568567 pub extern "C" fn luaL_optinteger( l: LuaState , narg: c_int, d: LuaInteger ) -> c_int;
569568
570569 /// If the function argument narg is a string, returns this string.
571- /// If this argument is absent or is nil, returns d . Otherwise, raises an error.
570+ /// If this argument is absent or is nil, returns ``default`` . Otherwise, raises an error.
572571 ///
573- /// If ``sz `` is not 0 , fills the position *``sz `` with the results's length.
574- pub extern "C" fn luaL_optlstring( l: LuaState , arg: c_int, d : LuaString , sz : SizeT )
572+ /// If ``len `` is not None , fills the position *``len `` with the results's length.
573+ pub extern "C" fn luaL_optlstring( l: LuaState , arg: c_int, default : LuaString , len : Option < * mut SizeT > )
575574 -> LuaString ;
576575
577576 /// If the function argument ``arg`` is a number, returns this number.
578- /// If this argument is absent or is nil, returns ``d ``. Otherwise, raises an error.
579- pub extern "C" fn luaL_optnumber( l: LuaState , arg: c_int, d : LuaNumber ) -> LuaNumber ;
577+ /// If this argument is absent or is nil, returns ``default ``. Otherwise, raises an error.
578+ pub extern "C" fn luaL_optnumber( l: LuaState , arg: c_int, default : LuaNumber ) -> LuaNumber ;
580579}
581580
582581dyn_symbols ! {
@@ -920,10 +919,10 @@ lua_macros! {
920919 lua_pushcclosure( l, fnc, 0 ) ;
921920 } ;
922921
923- /// Equivalent to lua_tolstring with len equal to 0
924- /// This may return None if the value at ``idx`` is not a string or a number, use [luaL_optstring] instead if you do not desire an Option<> or unwrap when you are absolutely sure of the type .
922+ /// Equivalent to `` lua_tolstring(l, idx, None)``
923+ /// This may return None if the value at ``idx`` is not a string or a number, use [luaL_optstring] instead if you do not desire an Option<>, or lua_checkstring for arguments .
925924 pub fn lua_tostring( l: LuaState , idx: c_int) -> Option <LuaString > {
926- lua_tolstring( l, idx, 0 )
925+ lua_tolstring( l, idx, None )
927926 } ;
928927
929928 /// Starts and resumes a coroutine in a given thread
@@ -1004,13 +1003,13 @@ lua_macros! {
10041003
10051004 /// Asserts that a string argument exists at index 'i'
10061005 pub fn luaL_checkstring( l: LuaState , i: c_int) -> LuaString {
1007- luaL_checklstring( l, i, 0 )
1006+ luaL_checklstring( l, i, None )
10081007 } ;
10091008
10101009 /// Like lua_tostring or luaL_checkstring, but instead of returning an invalid string / erroring,
10111010 /// It returns the given `default` string.
10121011 pub fn luaL_optstring( l: LuaState , i: c_int, default : LuaString ) -> LuaString {
1013- luaL_optlstring( l, i, default , 0 )
1012+ luaL_optlstring( l, i, default , None )
10141013 } ;
10151014
10161015 /// Sets the C function ``f`` as the value of global name ``name``.
0 commit comments