当前位置:网站首页>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.
边栏推荐
- Deep parsing pointer and array written test questions
- 07 singleton mode
- OCR文字识别方法综述
- 银行核心业务系统性能测试方法
- CobaltStrike-4.4-K8修改版安装使用教程
- resulttype和resultmap的区别和应用场景
- Rust language -- iterators and closures
- [unity3d] GUI control
- XSS challenges bypass the protection strategy for XSS injection
- StrError & PERROR use yyds dry inventory
猜你喜欢
【若依(ruoyi)】启用迷你导航栏
电机控制反Park变换和反Clarke变换公式推导
[ruoyi] set theme style
Introduction to robotframework (II) app startup of appui automation
Overview of OCR character recognition methods
Modeling specifications: naming conventions
[network security interview question] - how to penetrate the test file directory through
MySQL advanced notes
How to do function test well
华为、H3C、思科命令对比,思维导图形式从基础、交换、路由三大方向介绍【转自微信公众号网络技术联盟站】
随机推荐
八道超经典指针面试题(三千字详解)
Precautions for single chip microcomputer anti reverse connection circuit
MySQL learning notes-10-tablespace recycling
Handwriting database client
C language - Blue Bridge Cup - promised score
mysqldump数据备份
Fault analysis | analysis of an example of MySQL running out of host memory
Codeworks 5 questions per day (1700 average) - day 6
Solve 9 with C language × 9 Sudoku (personal test available) (thinking analysis)
Analyze menu analysis
JS regular filtering and adding image prefixes in rich text
Leetcode problem solving -- 108 Convert an ordered array into a binary search tree
技术分享 | undo 太大了怎么办
华为、H3C、思科命令对比,思维导图形式从基础、交换、路由三大方向介绍【转自微信公众号网络技术联盟站】
适合程序员学习的国外网站推荐
Introduction to robotframework (II) app startup of appui automation
How to do function test well
tcpdump: no suitable device found
Audio-AudioRecord Binder通信机制
[pointer training - eight questions]