Lua; states, threads, libraries and memory layout