2

我想知道如何在 lua 5.2.3 中创建和使用新的 C 库。由于我在嵌入式系统上,我不能使用动态库(需要,共享库,...)。我找到了答案,但它适用于 lua 5.0 ( http://www.lua.org/pil/26.2.html ),因此不兼容。如果有人有想法?

4

2 回答 2

4

Edit linit.c and add your library entry point to it. Then add the modified linit.c to your project. The linker will use your copy instead of the one in the Lua library.

This assumes your app calls luaL_openlibs.

于 2014-08-14T15:50:56.010 回答
1

Lua 5.2 与 5.1/5.0 相比有一些 API 更改——因此请改用5.2.3 的参考。您还可以购买Programming in Lua 3rd edition for 5.2,其中更新了示例。

于 2014-08-14T15:06:46.953 回答