I am developing a 2d game for iPhone/iPad. Game will use lua for npc/location scripting and build-in lua interpreter.
I want to allow users to download new levels from our site. Level bundle will contain images, music and lua script that describe npc/location.
I know that Apple doesn't allow to download scripts from application. Maybe exist some workaround to do this? Script must have some limitations? Another script language? Lua byte-code?
Thank for answers.
Apple changed the developer agreement a while back to allow for limited interpreted code to be downloaded to apps and run: http://touchreviews.net/apple-lua-iphone-developer-agreement/
I've heard from more than one person that there are many games already in the App Store that are using Lua in the capacity you're indicating with no issues.
If you fetch the scripts as a part of a large file then how would Apple know? Also if your script is only used internally in your program then I can't see why that should be a problem. One of my appstore programs uses an internal script interpreter and I've never received any comments or warnings from Apple.
You might run into problems if you start compiling the scripts or try to access the iOS API through scripts but I doubt that is something you are doing.
Related
I want to make a Fortran editor in iPhone. User can code with Fortran in an iOS app and are also able to run that code on iPhone.
Can anyone guide me with correct approach?
I had a look to the gFortran, but its not available for ARM architecture.
Thankyou..
Apple doesn't allow for compilers or interpreters on the iPhone, but there technically isn't any reason you can't setup a server based compiler, that also allows users to run their compiled apps. In fact, there are multiple sites that already do just this, but it wouldnt be a good idea to write an app that points to their site or uses their services; you would need to setup your own service.
Not insurmountable, but I would move onto other app ideas.
Given Apple's snarly attitude about language interpreters running under iOS you're better off coding this as service that runs on a remote server, maybe with the editing part on the phone or tablet.
Updating this old thread for the sake of current and future searches:
Apple has changed their attitude over the past year or so. There are currently many interpreters available for iOS, including for Lua (https://itunes.apple.com/us/app/iluabox/id398073834?mt=8) and several for Python (https://itunes.apple.com/us/app/python-2.7-for-ios/id485729872?mt=8, http://itunes.com/apps/pythonmath).
One significant remaining restriction is that these apps may not load scripts from outside the app, for example, from Dropbox or iTunes file sharing. (This is part of Apple's efforts -- along with code signing and 100% app review -- to minimize malware.) Such apps are allowed to have an editor that allows the user to copy and paste code into the editor from outside the app.
As far as I know, there aren't any apps for compiled languages such as FORTRAN.
Meanwhile, FORTRAN compiler is available for iOS only as a jailbroken application.
[Disclaimer: I am the author of Python Math. Apple removed it from the store for a short time until I removed iTunes file sharing and "Open In..." capability. I then added a script editor.]
How would one call a Lua script from a block of Objective-C in an iOS app? Also, would an app that calls Lua scripts be accepted by Apple's review process?
There's no problem with running Lua code on iOS. The only thing that is banned by Apple is executing scripts that were downloaded from the network. All your executable code should be either bundled along with your app or user-created. For example, there's a great Lua IDE for the iPad called Codea.
For the technical side of your question please see Lua on the iPhone?
I have an application to develop but the problem is that is must download part of behavior as a list of instructions from a server.
Ideally it will download scripting code and execute it. The question is if there are any libraries to make it? For example, I have python script and I want to to execute it on device...
Any options?
thank you
Lua is very popular for games. You can embed Python, too. Apple won't enforce the "Objective-C only" clause unless you make it obvious that you use Python to script behavior. Do you think all the games on the store are scripted in Objective-C? No way. Just don't make your transgressions obvious and you'll be fine.
For security reasons, the app store does not allow apps containing programming languages capable of executing arbitrary code on the phone, so your app's market would be limited to users willing to jailbreak their phones to circumvent this restriction.
You could, depending on what you want to do, look at using the browser's JavaScript.
I've heard some conflicting things about the acceptability of scripting languages (e.g., Lua) in apps for the App Store. I'd like to hear from anyone who understands the policy regarding apps which contain some level of programmability, or someone who has had experience submitting such an app for approval.
For instance, suppose I want to develop a statistical package of some sort. It might provide the user with an application-specific language to code scripts that would manipulate data by calling built-in statistical functions.
If this scripting facility has no access to any entities outside of the application's sandbox, is it likely to present a hurdle to App Store acceptance?
Yes.
Using Javascript code run inside a UIWebView is an explicitly allowed scripting methodology. See PhoneGap for one example usage.
Other scripting languages may be acceptable if they do not run any downloaded code or compile any executable code (even JIT). This is standard methodology for many 3D game engines. (Apple's SDK agreement was changed to allow this circa September 2010.)
Added comments:
Other examples: There are at least 5 Basic interpreters and several programmable calculators currently in the iOS App Store. Perhaps interpreters for Scheme, Ruby and Python as well.
Unknown: If you were to develop an interpreter in Javascript for a statistical language, could that Javascript in a UIWebView download and interpret source code in that application specific statistical language?
If this scripting facility has no access to any entities outside of the application's sandbox [. . .]
Yes, that should be fine. The latest App Store guidelines explicitly permit interpreted code provided that it is not updated remotely.
I'm just recalling the days when Radio Shack used to sell pocket computers. (Many moons ago, w/ only a few K of memory.) They had the ability to write small programs on Pocket computer. Maybe it's just nostalgic, but I alway thought that was handy. (Through the fog of my memory.) Is there any capability like that for an Iphone?
Edit:
I can kinda understand not allowing a like a GameBoy emulator on the App-store, it's kinda like saying your ok with people loading "ROMs" and could get them in trouble. When you start profitting from an Emulator the license holders get pissy, just think about "Bleem" and Sony. Sony buried those guys. I suppose Javascript is better than nothing. What about Java in a sandbox? Or if they want something they aren't afraid is going to cannibalise there market, a BASIC interpreter.
I don't believe that you are allowed to in the terms of service for the App store. Isn't this why mono programs have to be staticly compiled if they are going up to the App store.
If you are looking to go off the beaten path, James Long's blog details how to run Gambit Scheme code on the iPhone. Load the application once and then load code changes progressively as needed.
In a following blog post, he details how to debug your applications remotely with an REPL. Very cool stuff. Between the simplicity of Scheme and the existing work he's done on his blog, a lot of the work/difficulty involved with developing in a "non-standard" way on the iPhone is taken care of for you. It's worth a shot!
Python is possible:
http://mail.python.org/pipermail/python-list/2008-November/686098.html
The only thing remotely close to that (without Jailbreaking) is Javascript/HTML in Mobile Safari.
While "on" your iphone is relative www.tilestack.com is a web based development environment that can produce webapps.
Terminal.app can be compiled for limited distribution (w/o jailbreaking). /bin/sh is a valid programming language. QED.
Yes, it is possible to set up a node.js programming environment that lets you run your own server on the iPad. It's also possible to run javascript using the textastic code editor. See Is it possible to do programming using iPhone?.