当前位置:网站首页>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.
边栏推荐
猜你喜欢

Introduction to robotframework (III) Baidu search of webui automation

适合程序员学习的国外网站推荐

建模规范:命名规范

OCR文字識別方法綜述

电机控制反Park变换和反Clarke变换公式推导

Misc (eternal night), the preliminary competition of the innovation practice competition of the National College Students' information security competition

【概念】Web 基础概念认知

NR modulation 1

Codeworks 5 questions per day (1700 average) - day 6

Microservice registration and discovery
随机推荐
Technology sharing | what if Undo is too big
NR modulation 1
#PAT#day10
What are the principles of software design (OCP)
Prototype design
Eight super classic pointer interview questions (3000 words in detail)
微服务间通信
My C language learning record (blue bridge) -- on the pointer
resulttype和resultmap的区别和应用场景
MySQL learning notes-10-tablespace recycling
【paddle】加载模型权重后预测报错AttributeError: ‘Model‘ object has no attribute ‘_place‘
[ruoyi] enable Mini navigation bar
【Kubernetes 系列】一文学会Kubernetes Service安全的暴露应用
Huawei, H3C, Cisco command comparison, mind map form from the basic, switching, routing three directions [transferred from wechat official account network technology alliance station]
Linear regression and logistic regression
深入探究指针及指针类型
BUUCTF刷题笔记——[极客大挑战 2019]EasySQL 1
XSS challenges绕过防护策略进行 XSS 注入
Microservice registration and discovery
下一个行业风口:NFT 数字藏品,是机遇还是泡沫?