drop string.dump, clean up docs around it
This commit is contained in:
parent
35a6794386
commit
ee7f893a7e
|
@ -2721,20 +2721,6 @@ Note that numerical codes are not necessarily portable across platforms.
|
|||
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
<hr><h3><a name="pdf-string.dump"><code>string.dump (function)</code></a></h3>
|
||||
|
||||
|
||||
<p>
|
||||
Returns a string containing a binary representation of the given function,
|
||||
so that a later <a href="#pdf-loadstring"><code>loadstring</code></a> on this string returns
|
||||
a copy of the function.
|
||||
<code>function</code> must be a Lua function without upvalues.
|
||||
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
<hr><h3><a name="pdf-string.find"><code>string.find (s, pattern [, init [, plain]])</code></a></h3>
|
||||
Looks for the first match of
|
||||
|
@ -2903,11 +2889,6 @@ Here are some examples:
|
|||
x = string.gsub("home = $HOME, user = $USER", "%$(%w+)", os.getenv)
|
||||
--> x="home = /home/roberto, user = roberto"
|
||||
|
||||
x = string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s)
|
||||
return loadstring(s)()
|
||||
end)
|
||||
--> x="4+5 = 9"
|
||||
|
||||
local t = {name="lua", version="5.1"}
|
||||
x = string.gsub("$name-$version.tar.gz", "%$(%w+)", t)
|
||||
--> x="lua-5.1.tar.gz"
|
||||
|
|
|
@ -380,10 +380,14 @@ static int luaB_newproxy (lua_State *L) {
|
|||
static const luaL_Reg base_funcs[] = {
|
||||
{"assert", luaB_assert},
|
||||
{"collectgarbage", luaB_collectgarbage},
|
||||
/* no 'dofile' without sandboxing it */
|
||||
{"error", luaB_error},
|
||||
{"gcinfo", luaB_gcinfo},
|
||||
{"getfenv", luaB_getfenv},
|
||||
{"getmetatable", luaB_getmetatable},
|
||||
/* no 'loadfile' without sandboxing it */
|
||||
/* no 'load' without sandboxing it */
|
||||
/* no 'loadstring' without sandboxing it */
|
||||
{"next", luaB_next},
|
||||
{"pcall", luaB_pcall},
|
||||
{"print", luaB_print},
|
||||
|
|
|
@ -137,25 +137,6 @@ static int str_char (lua_State *L) {
|
|||
}
|
||||
|
||||
|
||||
static int writer (lua_State *L, const void* b, size_t size, void* B) {
|
||||
(void)L;
|
||||
luaL_addlstring((luaL_Buffer*) B, (const char *)b, size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int str_dump (lua_State *L) {
|
||||
luaL_Buffer b;
|
||||
luaL_checktype(L, 1, LUA_TFUNCTION);
|
||||
lua_settop(L, 1);
|
||||
luaL_buffinit(L,&b);
|
||||
if (lua_dump(L, writer, &b) != 0)
|
||||
luaL_error(L, "unable to dump given function");
|
||||
luaL_pushresult(&b);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
** {======================================================
|
||||
|
@ -827,7 +808,7 @@ static int str_format (lua_State *L) {
|
|||
static const luaL_Reg strlib[] = {
|
||||
{"byte", str_byte},
|
||||
{"char", str_char},
|
||||
{"dump", str_dump},
|
||||
/* no 'dump' without sandboxing 'loadstring', etc. */
|
||||
{"find", str_find},
|
||||
{"format", str_format},
|
||||
{"gfind", gfind_nodef},
|
||||
|
|
Loading…
Reference in New Issue