在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):logiceditor-com/lua5.1.js开源软件地址(OpenSource Url):https://github.com/logiceditor-com/lua5.1.js开源编程语言(OpenSource Language):JavaScript 85.6%开源软件介绍(OpenSource Introduction):lua5.1.js: Lua 5.1, emscriptinized to JavaScript, with low-level API
Contains original Lua 5.1.5 implementation:
See file Project status:Current version v0.9.1 is a community preview version. This project is in early stages of its development. Early adopters are welcome. Production users should probably wait for a next release with better test coverage and more stable API. API:Pretty much all Lua C API should be supported. (Much of it untested though.)
See the TODO: Document API properly. Convention: all C numeric types are JS To use function pointers, you have to call Emscripten's API usage example: var C = Lua5_1.C;
var L = C.lua_open();
C.luaL_openlibs(L);
C.lua_pushcfunction(
L,
Lua5_1.Runtime.addFunction(
function(L)
{
var str = C.luaL_checkstring(L, 1);
alert("{Lua} " + str);
return 0;
}
)
);
C.lua_setglobal(L, "ALERT");
if (C.luaL_dostring(L, "ALERT('Hello, world')") != 0)
{
var err = C.lua_tostring(L, -1);
C.lua_close(L);
L = 0;
throw new Error("Lua error: " + err);
} Refer to Emscripten docs if you need more information: https://github.com/kripken/emscripten/wiki/Interacting-with-code Note: Pull requests to improve this document are very welcome. Bundling files for use with lua5.1.jsA simple packer tool, You can run it from
The You should include the bundle file after you include lua5.1.js itself. Run the tool as follows:
Resulting file path in JavaScript is local file path, moved from its local base path to the JavaScript base path. For example, for the command above, local file
See also How to build lua5.1.5.js:NOTE: You do not need to build To rebuild
If you want to rebuild the Lua VM itself, you need to do a few extra steps: (Note that you're most likely do not need to do that to contribute
to the project -- just change files in Instructions for a recent Ubuntu OS:
FAQ:
See also:File |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论