当前位置:网站首页>Lua uses require to load the shared library successfully, but the return is Boolean (always true)
Lua uses require to load the shared library successfully, but the return is Boolean (always true)
2022-07-06 03:11:00 【iMatt】
First look at require Help document for
If the loader returns any non-nil value,
require
assigns the returned value topackage.loaded[modname]
. If the loader does not return a non-nil value and has not assigned any value topackage.loaded[modname]
, thenrequire
assigns true to this entry
The meaning of this sentence is : If the loader returns a non null value , Then assign this non null value to package.loaded[modname] That is to say require The return value of . If the loader no return value , Then it will be assigned a true.
that , Why? loader There is no return value ? Nothing but 2 Medium condition
xxx.so( or xxx.dll) The agreed interface of the shared library int luaopen_xxx function
1、 Not to lua The stack returns nothing , That is, there is no direction lua Export any function .
2、 Export content , But I didn't tell lua.luaopen_xxx Signature compliance lua_CFunction, The passage of this function
returns in C the number of results( use C The number of results returned by the language ).
That is to say luaopen_xxx The return value of must not be 0, Usually export function table ,return 1.
边栏推荐
- Linear programming matlab
- [Yu Yue education] basic reference materials of digital electronic technology of Xi'an University of Technology
- [ruoyi] enable Mini navigation bar
- Audio audiorecord binder communication mechanism
- XSS challenges绕过防护策略进行 XSS 注入
- MySQL learning notes-10-tablespace recycling
- 【若依(ruoyi)】ztree 自定义图标(iconSkin 属性)
- Custom attribute access__ getattribute__/ Settings__ setattr__/ Delete__ delattr__ method
- Rust language -- iterators and closures
- CSP numeric sort
猜你喜欢
What is the investment value of iFLYTEK, which does not make money?
#PAT#day10
Reverse repackaging of wechat applet
【Kubernetes 系列】一文學會Kubernetes Service安全的暴露應用
How to do function test well
Modeling specifications: naming conventions
适合程序员学习的国外网站推荐
Fault analysis | analysis of an example of MySQL running out of host memory
[Yu Yue education] basic reference materials of digital electronic technology of Xi'an University of Technology
IPv6 jobs
随机推荐
Selenium share
Rust language -- iterators and closures
技术分享 | undo 太大了怎么办
XSS challenges bypass the protection strategy for XSS injection
深度解析指针与数组笔试题
电机控制反Park变换和反Clarke变换公式推导
Linear programming matlab
[ruoyi] enable Mini navigation bar
Problems encountered in 2022 work IV
Polymorphic day02
不赚钱的科大讯飞,投资价值该怎么看?
张丽俊:穿透不确定性要靠四个“不变”
【paddle】加载模型权重后预测报错AttributeError: ‘Model‘ object has no attribute ‘_place‘
SD卡報錯“error -110 whilst initialising SD card
C # create self host webservice
How to accurately identify master data?
What are the principles of software design (OCP)
Game theory matlab
Single instance mode of encapsulating PDO with PHP in spare time
Buuctf question brushing notes - [geek challenge 2019] easysql 1