当前位置:网站首页>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,
requireassigns 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], thenrequireassigns 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.
边栏推荐
- How to accurately identify master data?
- 微服务间通信
- 八道超经典指针面试题(三千字详解)
- Pat 1046 shortest distance (20 points) simulation
- Descriptor implements ORM model
- C # create self host webservice
- 【 kubernets series】 a Literature Study on the Safe exposure Applications of kubernets Service
- [pointer training - eight questions]
- The real machine cannot access the shooting range of the virtual machine, and the real machine cannot Ping the virtual machine
- 【若依(ruoyi)】启用迷你导航栏
猜你喜欢

2022工作中遇到的问题四

PMP practice once a day | don't get lost in the exam -7.5

CobaltStrike-4.4-K8修改版安装使用教程

Problems encountered in 2022 work IV

My C language learning records (blue bridge) -- files and file input and output
如何做好功能测试

银行核心业务系统性能测试方法

【若依(ruoyi)】设置主题样式

Overview of OCR character recognition methods

MySQL advanced notes
随机推荐
张丽俊:穿透不确定性要靠四个“不变”
Pat 1084 broken keyboard (20 points) string find
The difference between sizeof and strlen in C language
【若依(ruoyi)】启用迷你导航栏
ERA5再分析资料下载攻略
tcpdump: no suitable device found
07 singleton mode
How does yyds dry inventory deal with repeated messages in the consumption process?
Résumé des méthodes de reconnaissance des caractères ocr
Zhang Lijun: penetrating uncertainty depends on four "invariants"
NR modulation 1
Daily question brushing plan-2-13 fingertip life
js 正则过滤和增加富文本中图片前缀
Sign SSL certificate as Ca
Data and Introspection__ dict__ Attributes and__ slots__ attribute
How to read excel, PDF and JSON files in R language?
Solve 9 with C language × 9 Sudoku (personal test available) (thinking analysis)
Eight super classic pointer interview questions (3000 words in detail)
全国大学生信息安全赛创新实践赛初赛---misc(永恒的夜)
Reverse repackaging of wechat applet