当前位置:网站首页>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.
边栏推荐
猜你喜欢
![[kubernetes series] learn the exposed application of kubernetes service security](/img/61/4564230feeb988886fe595e3125ef4.png)
[kubernetes series] learn the exposed application of kubernetes service security

Recommended foreign websites for programmers to learn

Résumé des méthodes de reconnaissance des caractères ocr

Jenkins basic knowledge ----- detailed explanation of 03pipeline code

1. Dynamic parameters of function: *args, **kwargs

华为、H3C、思科命令对比,思维导图形式从基础、交换、路由三大方向介绍【转自微信公众号网络技术联盟站】
![[network security interview question] - how to penetrate the test file directory through](/img/48/be645442c8ff4cc5417c115963b217.jpg)
[network security interview question] - how to penetrate the test file directory through
![[ruoyi] enable Mini navigation bar](/img/28/a8b38aecd90c8ddc98333f0e2d3eab.png)
[ruoyi] enable Mini navigation bar

XSS challenges绕过防护策略进行 XSS 注入

Linear regression and logistic regression
随机推荐
[network security interview question] - how to penetrate the test file directory through
#PAT#day10
My C language learning record (blue bridge) -- under the pointer
OCR文字识别方法综述
[ruoyi] ztree custom icon (iconskin attribute)
XSS challenges绕过防护策略进行 XSS 注入
Inherit day01
SD card reports an error "error -110 whilst initializing SD card
[pointer training - eight questions]
Microservice registration and discovery
StrError & PERROR use yyds dry inventory
ERA5再分析资料下载攻略
My C language learning records (blue bridge) -- files and file input and output
张丽俊:穿透不确定性要靠四个“不变”
深度解析指针与数组笔试题
Introduction to robotframework (I) brief introduction and use
NR modulation 1
Leetcode problem solving -- 173 Binary search tree iterator
Precautions for single chip microcomputer anti reverse connection circuit
NR modulation 1