Note that there are some explanatory texts on larger screens.

plurals
  1. POHow could I embedded socket in Lua internally, just like oslib, debuglib?
    text
    copied!<p>I want to implement the function like embedding the socket function in my Lua build. So I don't need to copy socket.core.dll any more (just for fun).</p> <p>I search the maillist, and see some guys discuss the topic, <a href="http://lua-users.org/lists/lua-l/2005-10/msg00269.html" rel="nofollow noreferrer">http://lua-users.org/lists/lua-l/2005-10/msg00269.html</a></p> <p>But I have question for the details steps, who could give me a detailed steps for changing the lua and luasocket code to make them work together (not with dll method).</p> <p>I tried these steps in windows xp with VC2008:</p> <p>1) copy luasocket code to Lua project.</p> <p>2) add some code</p> <pre><code>static const luaL_Reg lualibs[] = { {"", luaopen_base}, {LUA_LOADLIBNAME, luaopen_package}, {LUA_TABLIBNAME, luaopen_table}, {LUA_IOLIBNAME, luaopen_io}, {LUA_OSLIBNAME, luaopen_os}, {LUA_STRLIBNAME, luaopen_string}, {LUA_MATHLIBNAME, luaopen_math}, {LUA_DBLIBNAME, luaopen_debug}, {LUA_SOCKETLIBNAME, luaopen_socket_core}, // add this line {LUA_MIMELIBNAME, luaopen_socket_core}, // add this line {NULL, NULL} }; </code></pre> <p>3) build the project, and run it.</p> <p>When I type <code>print(socket._VERSION)</code>, it shows <code>luasocket 2.0.2</code>, it is correct.</p> <p>When I type <code>print(socket.dns.toip("localhost"))</code>, it shows <code>127.0.0.1 table: 00480AD0</code>, it is correct too.</p> <p>But when I try to use other features, for example bind, it can't work.</p> <p>Who could tell me the reason?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload