开发者

Embedding Lua: how to programatically save a script to a folder, how to compile a script?

I am embedding Lua in a C++ application, and I am using luaL_dofile to load a script

However, I c开发者_StackOverflow社区annot seem to find documentation on the functions to use to:

  1. Compile a script (and save byte stream to a specified folder)
  2. Save a script to a specified folder

last but not the least, when I use luaL_dofile to load a script into the Lua engine, if the loaded script has a line that loads a module for example:

require 'strict'

which directory would the script.lua (or its compiled version) be loaded from?


Look up luaL_loadfile and lua_dump. See also test/luac.lua.


For the question about where Lua looks for modules require'd: It depends on package.path and package.cpath variables, which can be influenced by the environment variables LUA_PATH and LUA_CPATH.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜