alibaba / wax Goto Github PK
View Code? Open in Web Editor NEWThis project forked from probablycorey/wax
Wax is a framework that lets you write native iPhone apps in Lua.
Home Page: http://github.com/probablycorey/wax
License: MIT License
This project forked from probablycorey/wax
Wax is a framework that lets you write native iPhone apps in Lua.
Home Page: http://github.com/probablycorey/wax
License: MIT License
看了一下example工程,似乎只有 lua call OC的路径,没有OC call lua class的路径,就是类似于:
lua:
waxClass{"TwitterTableViewController", UITableViewController}
...
OC:
UITableViewController * vc = wax_instance_from("TwitterTableViewController");
[self.navigationController pushViewController:vc animated:NO];
I define a button,and set button‘s property selected is false,as a result, it is crashed,How can I do ? below is code:
function setupButton(self)
local bt = UIButton:initWithFrame(CGRect(200,100,100,30))
self:view():addSubview(bt)
bt:setSelected(false)
print(bt:selected())-- causes Runtime error: attempt to call method 'selected' (a nil value)
end
I have 2 view controllers, in VC1 I pushed VC 2 into navigation controller. I need to implement delegate to get callback from VC2 to VC1 in wax
如题,刚开始学习lua,之前是搞iOS开发的,想知道能否实现如题所示的情况,如果可以的话,该怎么在SublimeText3里面进行配置;如果不行,那怎么配置才能实现能够使用wax提供的lua调用OC的方法呢?
when I use block in lua, it returns this error.
This code is exactly the same as the examples, I do not know why.
How do I solve this problem?
thanks a lot.
it seems that have a bad data type,how to fix it
若修改父类中的A函数,而它的子类又没有被lua修改时。调用子类会崩溃,错误是子类里面没有A函数。
原因:
waxDefinedSelectorClassDictionary 里没有注册子类
修改方法:
修改 isClassSelectorDefinedInWax函数
`BOOL isClassSelectorDefinedInWax(NSString *klassStr, NSString *selStr){
if(klassStr == nil || selStr == nil) return NO;
BOOL isDefined = NO;
if(waxDefinedSelectorClassDictionary){
//derived calss forwarding selector will use base class's forwarding
BOOL hasInWax = waxDefinedSelectorClassDictionary[klassStr];
while (!hasInWax && ![klassStr isEqualToString:@"NSObject"]) {
klassStr =[NSString stringWithFormat:@"%@", [NSClassFromString(klassStr) superclass]];
hasInWax = waxDefinedSelectorClassDictionary[klassStr];
}//fix crash
while (!isDefined && hasInWax) {
NSArray *replaceMethodList = waxDefinedSelectorClassDictionary[klassStr];
for(NSDictionary *dict in replaceMethodList){
NSString *tmpClassStr = dict[@"class"];
NSString *tmpSelStr = dict[@"sel"];
if(tmpClassStr && [tmpClassStr isEqualToString:klassStr] &&
tmpSelStr && [tmpSelStr isEqualToString:selStr]){
isDefined = YES;
break;
}
}//for
if(!isDefined){
Class klassSuper = [NSClassFromString(klassStr) superclass];
klassStr = NSStringFromClass(klassSuper);
}
}
}
return isDefined;
}`
不知道这样处理会不会有其他的问题?
你好,block使用中有个问题,直接贴代码吧。
waxClass{"MenuDetailController", UIViewController}
function viewDidLoad( self )
self:setTitle("Menu Detail")
self:view():setBackgroundColor(UIColor:whiteColor())
local label = UILabel:initWithFrame(CGRect(20, 84, 300, 60))
self.label = label
label:setBackgroundColor(UIColor: cyanColor())
label:setText("Menu Detail")
label:setFont(UIFont:boldSystemFontOfSize(36))
self:view():addSubview(label)
-- self:updateConstraints(self);
UIView:animateWithDuration_animations_completion(1,
toblock(
function()
-- self.label:setCenter(CGPoint(200, 200))
print("in block")
end
),
toblock(
function(finished)
print('lua animations completion ' .. tostring(finished))
end
,{"void", "BOOL"})-- return void
)
end
运行后崩溃,错误提示如下:
1: (string) 'MenuDetailController.lua:17: attempt to call global 'toblock' (a nil value)'
Lua panicked and quit: Error calling 'viewDidLoad' on '<MenuDetailController: 0x7fa6d2934a60>'
MenuDetailController.lua:17: attempt to call global 'toblock' (a nil value)
stack traceback:
[C]: in function 'toblock'
MenuDetailController.lua:17: in function <MenuDetailController.lua:3>
代码里的block调用是按照示例来写的,有空请帮忙看看,谢谢
在lua中重写OC函数后,若原OC函数在会在多线程调用时,且函数实例会被销毁的情况下。wax会发生崩溃
崩溃点:hookForwardInvocation函数中
代码 ((void(*)(id, SEL, id))objc_msgSend)(self, @selector(ORIGforwardInvocation:), anInvocation);
我自己的修改方法:删除 代码_lastForwardClassSelecotorKey = callClassSelectorKey;
我觉得使用_lastForwardClassSelecotorKey的逻辑似乎 是在进行多线程保护,但好像这个逻辑又没有必要, 不知道这样改对不对?
英文不好, 用中文描述下.
我OC的代码的方法中包含了下划线, 比如btn_click. 现在想用wax去重写这个方法以改变默认执行, 但是wax会把这个理解成 btn:() click:(), 我该怎么解决这个下划线的问题才能调用到?
感觉各位大神的帮助!~~~
I wrote the code blow but when I run this code message 'MoboSDK_Login is not loaded' is printed. Please help me resolve this issue.
lua_getglobal(wax_currentLuaState(), "DisplayEnterPhoneControllerWithChannel");
if (lua_type(wax_currentLuaState(), -1) != LUA_TTABLE) {
NSLog(@"MoboSDK_Login is not loaded");
}
lua_pushstring(wax_currentLuaState(), "This is channel :)");
if (lua_pcall(wax_currentLuaState(), 1, 0, 0)) {
NSLog(@"Lua Error: %s\n", lua_tostring(wax_currentLuaState(), -1));
}
Error opening wax scripts: loading wax stdlib: cannot load incompatible bytecode —— 32位的coco2d-x 使用的 luajit ,在调用 wax_startWithNil() 这个方法的时候 ,提示 Error opening wax scripts: loading wax stdlib: cannot load incompatible bytecode。这种用什么样的方案进行处理会比较好呢 ?
要如何使用,才可以通过 luajit 的库,编译出一个 wax_stdlib.h 文件? 因为,使用现有项目中的 compile-stdlib32&64.sh 编译出来的头文件,在 luajit 下没办法成功读取。
ObjectiveGumbo 是用 pod 安装的一个库,在 oc 里 import <ObjectiveGumbo.h>
这样导入没问题,但在 .lua 文件中写 require "ObjectiveGumbo.h"
和 require "ObjectiveGumbo"
均报错:
Error opening wax scripts: ParserController.lua:1: module 'ObjectiveGumbo.h' not found:
no field package.preload['ObjectiveGumbo.h']
no file 'scripts/ObjectiveGumbo/h.lua'
no file 'scripts/ObjectiveGumbo/h/init.lua'
no file 'scripts/ObjectiveGumbo/h.dat'
no file 'ObjectiveGumbo/h.lua'
no file 'ObjectiveGumbo/h/init.lua'
no file 'ObjectiveGumbo/h.dat'
是写法问题还是因为不在文件搜索路径里?
Hi,here is my problem:
I use the method "wax_start" to init wax,just like this:
NSString *doc = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *dir = [doc stringByAppendingPathComponent:@"lua"];
NSString *pp = [[NSString alloc ] initWithFormat:@"%@/?.lua;%@/patch/?.lua;", dir, dir];
setenv(LUA_PATH, [pp UTF8String], 1);
wax_start("patch", nil);
"patch" is a lua file named patch.lua ,
require "MainViewController" require "SecondViewController"
MainViewController.lua:
waxClass{"MainViewController", UIViewController}
function viewDidLoad(self)
self:ORIGviewDidLoad(self)
self:addDeletePatchButton(self)
end
function setBackGroundColor(self)
self:view():setBackgroundColor(UIColor:yellowColor())
end
function addDeletePatchButton(self)
local deletebutton = UIButton:buttonWithType(UIButtonTypeCustom)
deletebutton:setFrame(CGRect(100, 300, 200, 100))
deletebutton:setTitle_forState("second",UIControlStateNormal)
deletebutton:setTitleColor_forState(UIColor:blueColor(),UIControlStateNormal)
deletebutton:addTarget_action_forControlEvents(self,"second",UIControlEventTouchUpInside)
self:view():addSubview(deletebutton)
end
function second(self)
local secondController = SecondViewController:init()
self:presentViewController_animated_completion(secondController,YES,nil)
end
SecondViewController.lua:
waxClass{"SecondViewController", UIViewController}
function viewDidLoad(self)
self:setBackGroundColor(self)
self:addDeletePatchButton(self)
end
function setBackGroundColor(self)
self:view():setBackgroundColor(UIColor:greenColor())
end
function addDeletePatchButton(self)
local deletebutton = UIButton:buttonWithType(UIButtonTypeCustom)
deletebutton:setFrame(CGRect(100, 300, 200, 100))
deletebutton:setTitle_forState("updatedback7",UIControlStateNormal)
deletebutton:setTitleColor_forState(UIColor:blackColor(),UIControlStateNormal)
deletebutton:addTarget_action_forControlEvents(self,"updatedback",UIControlEventTouchUpInside)
self:view():addSubview(deletebutton)
end
function updatedback(self)
self:dismissViewControllerAnimated_completion(YES,nil)
end
Now I want to update the code of MainViewController.lua,to change the action of function "second" ,so I download the new MainViewController.lua file from Server ,How can I make the new file work?
I wrote a test code like this:
function test()
local r = CGRect(1,1,2,2);
end
test();
and debug in createClosure method, wax_struct_userdata *structUserdata will allocate some memory. but the __gc breakpoint never reached.
is it a leak? or I had make a mistake?
When I try to write a UIButton and layout with Masonry it does not work! Who can look up in my code, it happen to crash while running!
Here:
add a UIImageView to cell.contentView
--local weakSelf = self
button:masUNDERxLINEmakeConstraints(
toblock(
function(make)
make:left():masUNDERxLINEequalTo(self:contentView())
make:top():masUNDERxLINEequalTo(self:contentView())
make:right():masUNDERxLINEequalTo(self:contentView())
make:height():masUNDERxLINEequalTo(50)
end,{"void","id"}
)
)
+[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:]: A multiplier of 0 or a nil second item together with a location for the first attribute creates an illegal constraint of a location equal to a constant. Location attributes must be specified in pairs
wax/tools/Framework/Scripts/package 最後兩行的腳本寫的有問題,沒法生成wax.framework。。。
读取沙盒中的lua文件并运行时报错
Currently 5.1
Any plans on upgrading the version of Lua used?
I'm particularly interested on getting pcall & coroutine.yield interaction issues solved, which seems to be only possible on >=5.2.
Hello, I would like to get more information about how Wax maps (or give access) to all Obejctive-c iOS class in Lua. Where can I find this information on source code? Thanks!
这类应用容易被app store拒, 如果可以列出哪些app在用,可以增强使用者信心。
Analyzing dependencies
Pre-downloading: wax
from https://github.com/alibaba/wax.git
, tag 1.1.0
[!] The wax
pod failed to validate due to 1 error:
- ERROR | attributes: Missing required attribute source
.
我用iOSOpenDev创建了一个越狱插件的项目,然后不管是用添加源码还是添加framework的模式使用wax,在编译时都会提示Undefined symbols for architecture arm64,不能正常编译通过,但是example里的普通应用,却能编译通过,不知什么原因
I want to upload an image to server. How can I set image to url?
function HTTPMultipartBeginMethod(url, fileData, completionHandler)
puts ('HTTPMultipartBeginMethod')
print ('request url: '..url)
local requestcallback = function(body, response)
if response == nil then
HTTPFailureProcessing(0, nil, completionHandler)
else
local statusCode = response:statusCode()
if statusCode == 200 then
print 'request successed'
HTTPSuccessProcessing(statusCode, body, completionHandler)
else
print 'request failure'
HTTPFailureProcessing(statusCode, body, completionHandler)
end
end
end
local base64 = require 'Base64'
local avatar = base64.enc(fileData)
local requestheaders = {}
requestheaders['Content-Type'] = 'multipart/form-data; boundary=0xKhTmLbOuNdArY'
local requestbody = [[
--0xKhTmLbOuNdArY
Content-Disposition: form-data; name="submit-name"
Larry
--0xKhTmLbOuNdArY
Content-Disposition: form-data; name="avatar"; filename="image.png"
Content-Type: application/octet-stream
... contents of image.png ...
hello
--0xKhTmLbOuNdArY--]]
puts (requestbody)
wax.http.request{ url, headers = requestheaders, body = requestbody, callback = requestcallback}
end
There random SEGV_ACCERR while application frequently calling wax. Please help.
Here is the dump:
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0x7865646e69206f8c
Crashed Thread: 1
Thread 0:
0 libunwind.dylib 0x00000001813efb74 0x1813ec000 + 15220
1 libunwind.dylib 0x00000001813eda2c 0x1813ec000 + 6700
2 libunwind.dylib 0x00000001813f0b20 0x1813ec000 + 19232
3 libc++abi.dylib 0x0000000180dc284c 0x180da8000 + 108620
4 libobjc.A.dylib 0x0000000180dd0094 0x180dc8000 + 32916
5 CoreFoundation 0x00000001817615c0 0x18163c000 + 1201600
6 Application1 0x0000000100c3efe0 wax_panic (wax.m:71)
7 Application1 0x0000000100c27e64 luaD_throw (ldo.c:104)
8 Application1 0x0000000100c27a98 luaG_runerror (ldebug.c:636)
9 Application1 0x0000000100c277d8 luaG_typeerror (ldebug.c:578)
10 Application1 0x0000000100c36fb4 luaV_settable (lvm.c:151)
11 Application1 0x0000000100c209cc lua_setfield (lapi.c:666)
12 Application1 0x0000000100c21e94 luaL_openlib (lauxlib.c:260)
13 Application1 0x0000000100c22930 luaopen_base (lbaselib.c:650)
14 Application1 0x0000000100c28404 luaD_precall (ldo.c:319)
15 Application1 0x0000000100c28884 luaD_call (ldo.c:376)
16 Application1 0x0000000100c20d74 lua_call (lapi.c:783)
17 Application1 0x0000000100c2aaac luaL_openlibs (linit.c:32)
18 Application1 0x0000000100c3f084 wax_setup (wax.m:88)
19 Application1 0x0000000100c3f4c4 wax_start (wax.m:101)
20 Application1 0x00000001004ae200 -TKPatchManager runWithFilePath:
21 libdispatch.dylib 0x00000001811b5630 0x1811b4000 + 5680
22 libdispatch.dylib 0x00000001811b55f0 0x1811b4000 + 5616
23 libdispatch.dylib 0x00000001811bacf8 0x1811b4000 + 27896
24 CoreFoundation 0x0000000181718bb0 0x18163c000 + 904112
25 CoreFoundation 0x0000000181716a18 0x18163c000 + 895512
26 CoreFoundation 0x0000000181645680 0x18163c000 + 38528
27 GraphicsServices 0x0000000182b54088 0x182b48000 + 49288
28 UIKit 0x00000001864bcd90 0x186440000 + 511376
29 Application1 0x000000010012b42c main (main.m:22)
30 ??? 0x00000001811e68b8 0x0 + 0
Thread 1 Crashed:
0 Application1 0x0000000100c34f20 luaH_getstr (ltable.c:458)
1 Application1 0x0000000100c20a40 lua_rawset (lapi.c:677)
2 Application1 0x0000000100cb904c wax_instance_pushUserdataTable (wax_instance.m:191)
3 Application1 0x0000000100cb8f3c wax_instance_pushUserdata (wax_instance.m:267)
4 Application1 0x0000000100cb9370 wax_instance_pushFunction (wax_instance.m:229)
5 Application1 0x0000000100cba784 hookForwardInvocation (wax_instance.m:607)
6 CoreFoundation 0x00000001817653e8 0x18163c000 + 1217512
7 CoreFoundation 0x000000018166968c 0x18163c000 + 185996
8 Foundation 0x00000001820e78ac 0x182030000 + 751788
9 Foundation 0x000000018203cafc 0x182030000 + 51964
10 Foundation 0x00000001820eaa30 0x182030000 + 764464
11 Application1 0x0000000100a1abd8 -MTLModel dictionaryValue
12 Application1 0x0000000100a19ea0 -MTLModel(NSCoding) encodeWithCoder:
13 Foundation 0x000000018209b3f0 0x182030000 + 439280
14 Foundation 0x00000001820a2258 0x182030000 + 467544
15 Application1 0x0000000100545f6c -ApplicationConfig SaveForumConfigModelToUserReference:ForumID:
16 Application1 0x0000000100546720 -ApplicationConfig ArchiveForumConfigModel:ForumID:
17 Application1 0x000000010054b1b8 -ApplicationConfig ParseForumConfig:ForumID:
18 Application1 0x00000001005481ac -ApplicationConfig ParseDirectoryConfig:
19 Application1 0x00000001003c6f08 -TKAccountsManager updateAccountsFromServerDictList:forums:
20 Application1 0x00000001005ac7ec __66-[TKIDManager asyncUserInfoAndGetAccountInfo:failedBlock:]_block_invoke_2 (TKIDManager.m:331)
21 libdispatch.dylib 0x00000001811b5630 0x1811b4000 + 5680
22 libdispatch.dylib 0x00000001811b55f0 0x1811b4000 + 5616
23 libdispatch.dylib 0x00000001811c3a88 0x1811b4000 + 64136
24 libdispatch.dylib 0x00000001811c3224 0x1811b4000 + 61988
25 libsystem_pthread.dylib 0x00000001813c9470 0x1813c8000 + 5232
26 libsystem_pthread.dylib 0x00000001813c9020 0x1813c8000 + 4128
请问在wax中如何使用bytecode的lua脚本呢? 支持哪种形式呢?
-(RB_MoreOptionCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
RB_MoreOptionCell *cell = [tableView dequeueReusableCellWithIdentifier:RB_MoreOptionCellIdentifier];
cell.lbl_detail.text = @"success";//No error
return cell;
}
waxClass{"RB_SettingsVC", "RB_BaseVC", protocols = {"UITableViewDelegate", "UITableViewDataSource"}}
function tableView_cellForRowAtIndexPath(self, tableView, indexPath)
local cell = self:ORIGtableView_cellForRowAtIndexPath(tableView, indexPath)
local hehe = cell:lbl_detail()
hehe:setText("xxx") // crashed!
return cell
end
Crashed when setting text of cell:lbl_detail,
All NSNumber value in wax will be changed to __NSCFNumber
If I got a var with [NSNumber numberWithBool:], the class should be _NSCFBoolean
Under some circumstance like keychain, the class must be right.
objCType in NSNumber might help.
怎么解决这个问题,求大神讲解
The info is below:
/usr/local/bin/pod install --verbose
What did you do?
What did you expect to happen?
What happened instead?
CocoaPods : 1.1.1
Ruby : ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
RubyGems : 2.6.7
Host : Mac OS X 10.12.1 (16B2555)
Xcode : 8.0 (8A218a)
Git : git version 2.8.4 (Apple Git-73)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib
Repositories : master - https://github.com/CocoaPods/Specs.git @ 53d1483163de88ff5c4c7364139a7bbcf8991ae3
cocoapods-deintegrate : 1.0.1
cocoapods-plugins : 1.0.0
cocoapods-search : 1.0.0
cocoapods-stats : 1.0.0
cocoapods-trunk : 1.1.1
cocoapods-try : 1.1.0
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
# use_frameworks!
target ‘Doctor’ do
platform :ios, ‘8.0’
pod 'wax', :git=>'https://github.com/alibaba/wax.git', :tag=>'1.1.0'
pod 'MJRefresh', '3.1.0'
pod 'AFNetworking', '~> 3.0'
pod 'MBProgressHUD', '~> 0.9.1'
pod 'SDWebImage', '~>3.7'
pod 'FMDB'
pod 'JSONModel'
pod 'WebViewJavascriptBridge', '~> 5.0'
pod 'KILabel', '1.0.1'
pod 'UMengAnalytics'
pod 'UMengSocial', '~> 5.0'
pod 'SSZipArchive'
pod 'SSKeychain'
pod 'YYKit'
end
NoMethodError - undefined method `dirname' for nil:NilClass
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/validator.rb:261:in `dot_swift_version'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/validator.rb:145:in `failure_reason'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/external_sources/abstract_external_source.rb:176:in `validate_podspec'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/external_sources/abstract_external_source.rb:163:in `store_podspec'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/external_sources/abstract_external_source.rb:119:in `block in pre_download'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/user_interface.rb:85:in `titled_section'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/external_sources/abstract_external_source.rb:112:in `pre_download'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/external_sources/downloader_source.rb:13:in `fetch'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer/analyzer.rb:639:in `fetch_external_source'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer/analyzer.rb:615:in `block (2 levels) in fetch_external_sources'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer/analyzer.rb:614:in `each'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer/analyzer.rb:614:in `block in fetch_external_sources'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer/analyzer.rb:613:in `fetch_external_sources'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer/analyzer.rb:73:in `analyze'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:236:in `analyze'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:150:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:149:in `resolve_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/installer.rb:110:in `install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/command/install.rb:37:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/lib/cocoapods/command.rb:50:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.1.1/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'
And when I try to adding wax to my Podfile, I have these error info. I am uncertainly whether it is caused by wax.
wax_runLuaFile does not print any error found on lua script. I' have made a change in the source to look like this:
int wax_runLuaFile(const char *script){
[wax_globalLock() lock];
int i = luaL_dofile(wax_currentLuaState(), script);
if( i != 0 )
fprintf(stderr,"Error opening wax scripts: %s\n", lua_tostring(wax_currentLuaState(),-1));
[wax_globalLock() unlock];
return i;
}
and now I can see the errors.
自定义类型为BookInfo包括NSDictionary类型的menu(目录)和NSString类型的name(名字)。
代码如下:
local gBookInfo = BookInfo:sharedInstance() --gBookInfo是userdata(用户自定义)类型
在Lua中通过BookInfo中的ShareInstance方法,取得实体。现在我需要在Lua中解析gBookInfo的menu字段,却找不到合适的方法。求解答,万分感谢!!!
I've got an issue while accessing CGFloat, using getIvarDouble method.
CGFloat is defined as float on non-64bits platform, while defined as double on 64bits platform.
#if defined(__LP64__) && __LP64__
# define CGFLOAT_TYPE double
# define CGFLOAT_IS_DOUBLE 1
# define CGFLOAT_MIN DBL_MIN
# define CGFLOAT_MAX DBL_MAX
#else
# define CGFLOAT_TYPE float
# define CGFLOAT_IS_DOUBLE 0
# define CGFLOAT_MIN FLT_MIN
# define CGFLOAT_MAX FLT_MAX
#endif
This leads to a problem: When we need to access a member using getIvarXXXX method, we have to determine whether we should use getIvarDouble or getIvarFloat, regarding to platform.
Since we've already have getIvarCGPoint/getIvarCGSize/getIvarCGRect method, it will be very helpful to have a getIvarCGFloat method, which would makes wax easier to use in this case.
self.window:addSubview()
改为
self:setRootViewController()
什么时候能支持Swift呀??
Swift现在这么流行,已经有很多项目用Swift开发了。
说明就不能用中文来写吗?最不济也应该一份英文一份中文。全整英文什么心态
比如用系统方法解析JSON数据:
NSError *error = nil;
NSDictionary *parseDict = [NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingAllowFragments
error:&error];
第三个参数是NSError **类型的,改用Lua该如何表示?
local err = ???
local parseDict = NSJSONSerialization:JSONObjectWithData_options_error(data, 8, err)
if err then --?
...
end
试了下err = {}
,会提示类型不匹配Can't convert table to wax_instance_userdata.
,也不能用nil呀,求教,非常感谢~
same as the title
Yo,
How can I get any error message from lua level when I wax_runLuaString
a lua script (like missing end
)?
Is this possible in wax? Thanks!
- (void)btnClick
{
/**
* 此处测试频繁释放被打补丁的对象
* 发现会存在崩溃的问题
*/
if (self.ocView) {
[self.ocView removeFromSuperview];
self.ocView = nil;
}
else {
self.ocView = [[OCView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:self.ocView];
[self.view bringSubviewToFront:self.button];
}
}
lua:
================================
waxClass{"OCView",UIView}
function initWithFrame(self,frame)
print 'view init'
self = super:initWithFrame(frame)
if self ~= nil then
self:setBackgroundColor(UIColor:blueColor())
end
return self
end
===============================
Can I use custom tableview cell with .xib with wax framework? If it available please help me use it
Thanks
local alert = UIAlertView:initWithTitle_message_delegate_cancelButtonTitle_otherButtonTitles("title", "message", nil, "cancel", "continue", nil)
otherButtonTitles can take multiple arguments, how can I pass the parameters?
Hey guys,
Thanks for keeping update wax. It's useful. We'd like to use it to make hot patch.
You guys made it possible to use block in wax.
How about another issue on wax that it couldn't replace the methods with "_" in the name? Do you have any idea?
is there a method to set the header of the http request please?
Undefined symbols for architecture x86_64:
"_wax_LongLong_call", referenced from:
_wax_LongLong_call_0 in wax_imp_call_pool.o
_wax_LongLong_call_1q in wax_imp_call_pool.o
_wax_LongLong_call_1d in wax_imp_call_pool.o
_wax_LongLong_call_2qq in wax_imp_call_pool.o
_wax_LongLong_call_2qd in wax_imp_call_pool.o
_wax_LongLong_call_2dq in wax_imp_call_pool.o
_wax_LongLong_call_2dd in wax_imp_call_pool.o
"_wax_double_call", referenced from:
_wax_double_call_0 in wax_imp_call_pool.o
_wax_double_call_1q in wax_imp_call_pool.o
_wax_double_call_1d in wax_imp_call_pool.o
_wax_double_call_2qq in wax_imp_call_pool.o
_wax_double_call_2qd in wax_imp_call_pool.o
_wax_double_call_2dq in wax_imp_call_pool.o
_wax_double_call_2dd in wax_imp_call_pool.o
...
When I run some example in this project ,always get this ...
Hey, do you have any idea about this crash issue?
Which object is dealloc? The block or parameter of the block?
We invoked the block in the main thread by dispatch_async
. Does it caused the crash?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.