lua 对象与 c++对象及互调
来源:互联网 发布:开淘宝店卖土特产 编辑:程序博客网 时间:2024/06/17 05:22
记录下别人的好的Blog链接
lua调用c++类对象这里写链接内容
lua调用lua类这里写链接内容
luaViewSDK 执行脚本堆栈
lvNewButton luaD_precall luaV_execute luaD_call f_call luaD_rawrunprotected luaD_pcall lua_pcall lv_runFunctionWithArgs lv_runFunction -[LuaViewCore runData:fileName:changeGrammar:] -[LuaViewCore runData:fileName:] -[LuaViewCore runFile:] -[LuaView runFile:]
oc代码
- (void) initlua{ NSString * str = [[NSBundle mainBundle] pathForResource:@"me" ofType:@"lua"]; CGRect cg = self.view.bounds; cg.origin = CGPointZero; self.lview = [[LView alloc] initWithFrame:cg]; self.lview.viewController = self; [self.view addSubview:self.lview]; [self.lview runFile: str];}
lua代码
function createButton( text , x,y,w,h, callback) local button = Button(); button:frame(x,y,w,h); button:text(text); button:backgroundColor(0xeeeeee); button:callback( function() print("ok",button); if( callback ) then callback(); end end); return button;endbutton1 = createButton("测试",10,10,300,60);button3 = Button();button3:frame(10,250,100,100);button3:image("button0.png","button1.png");button3:callback(function() local sourcestr = "This is a rainy day!"; local sourcelen = string.len(sourcestr); local xxlen=button3:selected(); print("\nthe len of sourcestr is "..sourcelen); print(xxlen); if xxlen then button3:selected(false); else button3:selected( true ); end print("我是图片按钮2");end);
点击按钮取串长度调用层次, oc调用 lua库函数string.len的层次
lua_tolstring luaL_checklstring str_len luaD_precall luaV_execute luaD_call f_call luaD_rawrunprotected luaD_pcall lua_pcall lv_runFunctionWithArgs lv_runFunction -[NSObject(NSObjectLuaView) lv_buttonCallBack] -[LVButton lvButtonCallBack]
oc调用 lua, lua回调oc调用层次
如按钮, 调用按钮的点击消息,消息实体在lua中,lua会调用Button取是否按下属性,然后取反操作,通过lua来改变按钮的按下和弹起状态。
selected luaD_precall luaV_execute luaD_call f_call luaD_rawrunprotected luaD_pcall lua_pcall lv_runFunctionWithArgs lv_runFunction -[NSObject(NSObjectLuaView) lv_buttonCallBack] -[LVButton lvButtonCallBack]
lua库函数加载及实现
linit.c中,有兴趣可以去解读下源代码
static const luaL_Reg lualibs[] = { {"", luaopen_base}, {LUA_LOADLIBNAME, luaopen_package}, {LUA_TABLIBNAME, luaopen_table}, {LUA_IOLIBNAME, luaopen_io}, {LUA_OSLIBNAME, luaopen_os}, {LUA_STRLIBNAME, luaopen_string}, {LUA_MATHLIBNAME, luaopen_math}, {LUA_DBLIBNAME, luaopen_debug}, {NULL, NULL}};
lua原理介绍这里写链接内容
osx lua命令行安装这里写链接内容
duilib与lua结合这里写链接内容
探密 lua内部实现这里写链接内容
阅读全文
0 0
- lua 对象与 c++对象及互调
- lua类与对象
- Lua与面向对象
- LUA 对象继承与注意
- Lua 与C/C++ 交互系列:Lua面向对象编程翻译
- Lua 对象
- lua 面向对象的实现及原理
- 在Lua中管理C对象
- LuaBridge:Lua绑定C/C++对象
- 为 Lua 绑定 C/C++ 对象
- C与面向对象
- C++-类与对象
- C++:类与对象
- C++(类与对象)
- 【c++】类与对象
- C++-类与对象
- lua面向对象与基于lua的状态机实现
- C#,json与对象互转
- IDEA破解
- 《OC基础教程》读书笔记8-字典NSDictionary,NSMutableDictionary
- 系统换了新签名,但是apk还是用老签名才能运行
- 编译算法:SSA上的条件常数传播
- dubbo入门简介
- lua 对象与 c++对象及互调
- 经典C语言编程注意点
- iOS11正式版要来了!这些iPhone请慎重升级!
- 算法题--合并两个排序的链表
- 斐波那契矩阵
- XML的学习笔记(一)————基本语法和规范
- POJ
- PHPer一枚
- 【AI】Java+Fileupload+JSTL+Face++实现人脸识别系统