Reputation: 915
I am making a game that I also want to port to many other platforms, and for this purpose I would like to write some of the game logic in a scripting language to ease porting.
I understand Apple are imposing restrictions on interpreted code though, and I wonder if there exists any safe scripting alternative for iOs4 and earlier?
I am thinking of something like writing the scripts as Javascript, pass them to an invisible UIwebView with parameters for running and then read back the results as a string that can be parsed. Is it feasible, and "Apple policy safe"? Pretty "hackish" though, but if someone did this before, I'd like to see how it was done...
If not, are there other alternatives?
Upvotes: 1
Views: 487
Reputation: 558
You can go for the LUA, link is given below-
I hope, it will help you.
Upvotes: 0
Reputation: 811
Lua, it's a scripting language that can be embedded in any program. Apple cannot ban this since it just tells the actual Objective-C what it needs to do and the actual Objective-C code renders stuff and makes changes.
Something like this:
Lua scripts -> Folder with scripts
Folder with scripts -> Compiler (not mandatory, but it is faster than cleartext scripts)
(Compiled) scripts -> Objective-C engine with Lua embedded
Engine -> Renders items
You should check out Lua in Corona SDK, this is a little expensive and I am working on this SDK right now.
I am thinking of something like writing the scripts as Javascript, pass them to an invisible UIwebView with parameters for running and then read back the results as a string that can be parsed. Is it feasible, and "Apple policy safe"? Pretty "hackish" though, but if someone did this before, I'd like to see how it was done...
It is perfectly safe, facebook does this, the Corona SDK supports this. You can also use NimbleKit.
Upvotes: 2
Reputation: 915
I found this webpage to provide the info I need.
http://iphoneincubator.com/blog/windows-views/how-to-inject-javascript-functions-into-a-uiwebview
Further, the newest instance of the iPhone developer license agreement states:
"....Applications must be originally written in Objective-C, C, C++, or JavaScript as executed by the iPhone OS WebKit engine..."
This clearly indicates applications running Javascript code interpreted this way should be safe from Apple's code police.
Upvotes: 0