Of course, because the userdata originates in c, there are no pre-defined operations for userdata in Lua.
当然,由于用户数据源自于c,因此在Lua中也没有对用户数据预定义操作。
Implementing the core logic of a program in Lua, rather than in c, might well dramatically reduce development time.
用Lua而不是c来实现程序的核心逻辑可以大大减少开发时间。
The third, and most flexible, is to mix and match these approaches, using Lua to script some actions, and code in C to manage others.
第三种方式,也是最灵活的方式,是混合上述两种方式,使用Lua脚本编写一些动作,而用C代码管理其他部分。
The second is to write a program primarily in C, then use embedded Lua as a way to store and report data and configuration.
第二种方法是主要用C编写一个程序,然后使用嵌入的 Lua来存储和报告数据和配置。
C functions can call Lua functions and vice versa, for example.
举例来说,c函数可以调用lua函数,反之亦然。
The simplicity of embedding Lua in code in other languages (but especially C) makes it an easy target for substantially improving the functionality of programs in other languages.
将Lua嵌入到其他语言(特别是C)编写的代码中非常简单,因此常常使用 Lua提高用其他语言编写的程序的功能性。
The inverse -- calling a C function from Lua -- is similar.
反之,在 Lua 中调用C函数也与之类似。
In a C-based API, embedded code would almost certainly be able to cause a crash; using the Lua interface, if user interface code can cause a crash, there is a bug that ought to get fixed.
在基于c的api中,嵌入的代码几乎都会导致崩溃;当使用lua界面时,如果用户界面代码导致崩溃,则存在需要修复的bug。
You use lua_pushcfunction() to convert a C function pointer into an internal Lua object.
可以使用 lua_pushcfunction()将一个C函数指针转换成一个内部Lua对象。
You use lua_pushcfunction() to convert a C function pointer into an internal Lua object.
可以使用 lua_pushcfunction()将一个C函数指针转换成一个内部Lua对象。
应用推荐