编写了一个带lua_c API的iOS SDK,接入cocos2d-x lua项目中出错

TaoismShi 2015-07-09 09:26:15
rt,我做了一个功能,需要oc和lua交互。现在代码已经写好了,想把它封装成一个framework,它和lua脚本的交互就像下图这样



现在发现一个问题,编译sdk时加入了原生lua,这个framework只要添加到应用程序中(只是添加,还没有使用),就出现了以下错误:
PANIC: unprotected error in call to Lua API (attempt to index a nil value)
猜测可能和 cocos2d自带的luajit.a冲突了。单纯的更换lua库不是个通用的办法,因为不能预知程序使用的是哪个库。请问有没有什么方法可以在编译sdk时不加入lua或者luajit,使用sdk时能够去调用程序中自带的lua库,从而实现更好的解耦?
...全文
132 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
TaoismShi 2015-07-13
  • 打赏
  • 举报
回复
已经解决,方案是把原来的oc-lua交互层拿出来,不参与静态库的编译。静态库中新增加一个中间件作为交互层,利用全局变量和发送自定义信号的方式实现向内部进行信息的传递。当然内部要注册相关信号的处理函数。
Create compelling 2D games with Learn cocos2d 2: Game Development with iOS. This book shows you how to use the powerful new cocos2d, version 2 game engine to develop games for iPhone and iPad with tilemaps, virtual joypads, Game Center, and more. It teaches you: The process and best practices of mobile game development, including sprite batching, texture atlases, parallax scrolling, touch and accelerometer input. How to enhance your games using the Box2D and Chipmunk physics engines and other cocos2d-related tools and libraries. How to add UIKit views to cocos2d and how to add cocos2d to UIKit apps. The ins and outs of the Kobold2D development environment for cocos2d and its pre-configured libraries, including cocos3d and Lua. Best of all, this book will have you making games right from the very start. It guides you step-by-step through the creation of sample games. These fun examples are modeled after popular App Store games and teach you key concepts of the new cocos2d 2 game engine and relevant tools like TexturePacker (texture atlas), PhysicsEditor (physics collision shapes), Particle Designer (particle effects), Glyph Designer (bitmap fonts), and others. This book offers a rock-solid introduction to creating games made entirely with cocos2d and little or no iOS SDK and OpenGL code. It also details alternative implementations, identifies the best free and commercial tools for cocos2d game development, features coverage of the author’s improved cocos2d game engine (Kobold2D), and even helps you enhance your game’s marketability on the App Store. What you’ll learn The process and best practices of mobile game development, including sprite batching, texture atlases, parallax scrolling, touch and accelerometer input. How to enhance your games using the Box2D and Chipmunk physics engines and other cocos2d-related tools and libraries. How to add UIKit views to cocos2d and how to add cocos2d to UIKit apps. The ins and outs of the Kobold2D development environment for cocos2d and its pre-configured libraries, including cocos3d and Lua.
Create compelling 2D games with Learn cocos2d 2:Game Development with iOS. This book shows you how to use the powerful new cocos2d, version 2 game engine to develop games for iPhone and iPad with tilemaps, virtual joypads, Game Center, and more. It teaches you: The process and best practices of mobile game development, including sprite batching, texture atlases, parallax scrolling, touch and accelerometer input. How to enhance your games using the Box2D and Chipmunk physics engines and other cocos2d-related tools and libraries. How to add UIKit views to cocos2d and how to add cocos2d to UIKit apps. The ins and outs of the Kobold2D development environment for cocos2d and its pre-configured libraries, including cocos3d and Lua. Best of all, this book will have you making games right from the very start. It guides you step-by-step through the creation of sample games. These fun examples are modeled after popular App Store games and teach you key concepts of the newcocos2d 2game engine and relevant tools like TexturePacker (texture atlas), PhysicsEditor (physics collision shapes), Particle Designer (particle effects), Glyph Designer (bitmap fonts), and others. This book offers a rock-solid introduction to creating games made entirely with cocos2d and little or no iOSSDK and OpenGL code. It also details alternative implementations, identifies the best free and commercial tools for cocos2d game development, features coverage of the author’s improved cocos2d game engine (Kobold2D), and even helps you enhance your game’s marketability on the App Store. What you’ll learn The process and best practices of mobile game development, including sprite batching, texture atlases, parallax scrolling, touch and accelerometer input. How to enhance your games using the Box2D and Chipmunk physics engines and other cocos2d-related tools and libraries. How to add UIKit views to cocos2d and how to add cocos2d to UIKit apps. The ins and outs of the Kobold2D development environment for cocos2d and its pre-configured libraries, including cocos3d and Lua. Who this book is for The book is aimed at beginning game developers looking for an easier and even more powerful way to create compelling 2D graphics using OpenGL and Objective-C. It is assumed that the reader will have some knowledge of object-oriented programming and the Apple and iPhone/iPad developer environment.
混淆(iOS马甲包无法,上架神器) 前言 机缘巧合偶遇iOS ,前期也使用过现有城市表面其他得工具,实际效果不太理想。经过大量实践,开发出功能齐全的。工具的主要功能OC,C ++已封装成Mac应用,其他功能还在封装,敬请期待。现有公测阶段:免费 提示 为了让大家快速上手及对比达到效果,新建了测试工程** **,大家在实际使用过程如果遇到问题,欢迎扩展测试工程,请在工程请注明错误的细节,有奖励。 1.2.0之前的老版本说明:简介:不涉及语法及编译要求,但可能后可能出现局部漏改或改错,请自行添加至黑名单过滤。适用项目:RN等尚未适应的混合项目。使用条件:目前能用v1.1.3,其他过期了 自述 马甲包的本质: 阶段一减低重复率,本人开发初期的版本和当前城市表面的其他工具基本相似,主要是'名称'替换这一个基本的功能 阶段二减少相似度(相同元素的正态分布),目前该工具通过优化及不断转换已经

29,028

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧