lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Am I reading the API description correctly? …
> 
> const char *luaL_optlstring (lua_State *L,
>                              int arg,
>                              const char *d,
>                              size_t *l);
> 
> 1. If arg is a string on the stack, return it and fill *l with it’s length.
> 2. If arg is NOT a string on the stack, and d is NOT NULL, return d and fill *l with the length of d.
> 3a. If arg is NOT a string on the stack, and d is NULL, *l is not set by Lua.
> 3b. If arg is NOT a string on the stack, and d is NULL, *l is undefined.

3c. If arg is NOT a string on the stack, and d is NULL, *l is set to zero.

This is what the API does.

-- Roberto