views:

30

answers:

2

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?

A: 

Lua

ohho
I am aware of Lua, but I assumed it is not safe to use as it may be banned by Apple whenever they feel like it? Wouldn't Javascript be safer, since it would be using their own Safari interpreter?
sinsro
Lua seems safe. There are many Apps using Lua, and for example the Corona SDK solely uses Lua and their Apps get approved. As long as it's not possible for the user to run or modify Lua scripts Apple is ok with that.
GamingHorror
A: 

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.

sinsro