JavaScript in Cocoa tutorial

Member
Posts: 78
Joined: 2002.06
Post: #1
I just finished a short tutorial on using JavaScript from Cocoa apps. It is really quite a nice and easy way to script things if you are using ObjC.
http://will.thimbleby.net/script/

It is quite short and hopefully will help if you are thinking of adding scripting to your apps. The example application is a very small but fun turtle drawing app scripted in JavaScript. Here's a quick screenshot of what the app does, using JavaScript to control the turtle to draw fractal trees.

[Image: turtle_small.png]

Let me know what you think.

cheers
-- Will
Quote this message in a reply
Member
Posts: 114
Joined: 2005.03
Post: #2
Cool, many thanks! I was just thinking about how to implement scripting in my game, I would have never thought that it can be done so easily.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #3
There's also py-objc and RubyCocoa that allow you to write "real" Cocoa code and transparently access object in the different languages. That means that there is pretty much no limits on what you can do in the "scripting" language.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 78
Joined: 2002.06
Post: #4
But sometimes, especially for games, you want limits on what you can do. The JavaScript bridge makes it very easy to set these limits where you want to, and that IMO is actually one of the attractions to it as a scripting language.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #5
This is also true I suppose.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Odd javascript bug anthony 2 3,797 Nov 28, 2010 08:29 AM
Last Post: anthony
  JavaScript Wise Druid 13 6,242 Oct 15, 2008 05:55 AM
Last Post: Wise Druid
  Help with text-based (Javascript) RPG assylian 3 4,905 Mar 18, 2006 03:18 PM
Last Post: Justin Brimm
  Anyone wants to make a JavaScript file OOP? Taxxodium 1 2,780 Sep 23, 2005 02:28 AM
Last Post: Taxxodium