Skip to content
Snippets Groups Projects
Commit 2032d495 authored by dg's avatar dg
Browse files

fuckit

git-svn-id: http://svn.net-core.org/repos/t-engine4@1995 51575b47-30f0-44d4-a5cc-537603b46e54
parent ad94417d
No related branches found
No related tags found
No related merge requests found
......@@ -977,3 +977,7 @@ function util.browserOpenUrl(url)
end
return false
end
function __dump_fct(f)
return string.format("%q", string.dump(f))
end
......@@ -680,7 +680,7 @@ int main(int argc, char *argv[])
init_gen_rand(time(NULL));
// Change to line buffering
setvbuf(stdout, (char *) NULL, _IOLBF, 0);
// setvbuf(stdout, (char *) NULL, _IOLBF, 0);
// Parse arguments
int i;
......
......@@ -138,9 +138,24 @@ static bool basic_serialize(lua_State *L, serial_type *s, int type, int idx)
dump_string(s, str, len);
writeZipFixed(s, "\"", 1);
} else if (type == LUA_TFUNCTION) {
/*
writeZipFixed(s, "loadstring(\"", 12);
lua_dump(L, dump_function, s);
writeZipFixed(s, "\")", 2);
*/
lua_getglobal(L, "__dump_fct");
lua_pushvalue(L, idx-1);
lua_call(L, 1, 1);
size_t len;
const char *str = lua_tolstring(L, -1, &len);
writeZipFixed(s, "loadstring(", 11);
writeZipFixed(s, str, len);
writeZipFixed(s, ")", 1);
lua_pop(L, 1);
} else if (type == LUA_TTABLE) {
lua_pushstring(L, "__CLASSNAME");
lua_rawget(L, idx - 1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment