├── Lua on iOS.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── Lua on iOS.xcworkspace └── contents.xcworkspacedata ├── Lua on iOS ├── AppDelegate.h ├── AppDelegate.m ├── Default-568h@2x.png ├── Default.png ├── Default@2x.png ├── Lua on iOS-Info.plist ├── Lua on iOS-Prefix.pch ├── LuaManager.h ├── LuaManager.m ├── Person.h ├── Person.m ├── ViewController.h ├── ViewController.m ├── en.lproj │ ├── InfoPlist.strings │ └── MainStoryboard.storyboard ├── foo.lua └── main.m ├── Podfile └── README.md /Lua on iOS.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | CB0790D91711973C00E4DD39 /* Person.m in Sources */ = {isa = PBXBuildFile; fileRef = CB0790D81711973C00E4DD39 /* Person.m */; }; 11 | CBBEB7CD1710E7DA00006539 /* LuaManager.m in Sources */ = {isa = PBXBuildFile; fileRef = CBBEB7CC1710E7DA00006539 /* LuaManager.m */; }; 12 | CBBEB7CF1710EAEC00006539 /* foo.lua in Resources */ = {isa = PBXBuildFile; fileRef = CBBEB7CE1710EAEC00006539 /* foo.lua */; }; 13 | CBF21DBF1710E5B000FCB91E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CBF21DBE1710E5B000FCB91E /* UIKit.framework */; }; 14 | CBF21DC11710E5B000FCB91E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CBF21DC01710E5B000FCB91E /* Foundation.framework */; }; 15 | CBF21DC31710E5B000FCB91E /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CBF21DC21710E5B000FCB91E /* CoreGraphics.framework */; }; 16 | CBF21DC91710E5B000FCB91E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = CBF21DC71710E5B000FCB91E /* InfoPlist.strings */; }; 17 | CBF21DCB1710E5B000FCB91E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CBF21DCA1710E5B000FCB91E /* main.m */; }; 18 | CBF21DCF1710E5B000FCB91E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CBF21DCE1710E5B000FCB91E /* AppDelegate.m */; }; 19 | CBF21DD11710E5B000FCB91E /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = CBF21DD01710E5B000FCB91E /* Default.png */; }; 20 | CBF21DD31710E5B000FCB91E /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = CBF21DD21710E5B000FCB91E /* Default@2x.png */; }; 21 | CBF21DD51710E5B000FCB91E /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = CBF21DD41710E5B000FCB91E /* Default-568h@2x.png */; }; 22 | CBF21DD81710E5B000FCB91E /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CBF21DD61710E5B000FCB91E /* MainStoryboard.storyboard */; }; 23 | CBF21DDB1710E5B000FCB91E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CBF21DDA1710E5B000FCB91E /* ViewController.m */; }; 24 | F82428B394B54612AFA019DE /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 26968ACD4C55486E99503630 /* libPods.a */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXFileReference section */ 28 | 26968ACD4C55486E99503630 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 29 | CB0790D71711973C00E4DD39 /* Person.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Person.h; path = "Lua on iOS/Person.h"; sourceTree = ""; }; 30 | CB0790D81711973C00E4DD39 /* Person.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Person.m; path = "Lua on iOS/Person.m"; sourceTree = ""; }; 31 | CBBEB7CB1710E7DA00006539 /* LuaManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LuaManager.h; sourceTree = ""; }; 32 | CBBEB7CC1710E7DA00006539 /* LuaManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LuaManager.m; sourceTree = ""; }; 33 | CBBEB7CE1710EAEC00006539 /* foo.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = foo.lua; sourceTree = ""; }; 34 | CBF21DBB1710E5B000FCB91E /* Lua on iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Lua on iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | CBF21DBE1710E5B000FCB91E /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 36 | CBF21DC01710E5B000FCB91E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 37 | CBF21DC21710E5B000FCB91E /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 38 | CBF21DC61710E5B000FCB91E /* Lua on iOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Lua on iOS-Info.plist"; sourceTree = ""; }; 39 | CBF21DC81710E5B000FCB91E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 40 | CBF21DCA1710E5B000FCB91E /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 41 | CBF21DCC1710E5B000FCB91E /* Lua on iOS-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Lua on iOS-Prefix.pch"; sourceTree = ""; }; 42 | CBF21DCD1710E5B000FCB91E /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 43 | CBF21DCE1710E5B000FCB91E /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 44 | CBF21DD01710E5B000FCB91E /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 45 | CBF21DD21710E5B000FCB91E /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 46 | CBF21DD41710E5B000FCB91E /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 47 | CBF21DD71710E5B000FCB91E /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/MainStoryboard.storyboard; sourceTree = ""; }; 48 | CBF21DD91710E5B000FCB91E /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 49 | CBF21DDA1710E5B000FCB91E /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 50 | F99505336E0F4F4A834663FE /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = SOURCE_ROOT; }; 51 | /* End PBXFileReference section */ 52 | 53 | /* Begin PBXFrameworksBuildPhase section */ 54 | CBF21DB81710E5B000FCB91E /* Frameworks */ = { 55 | isa = PBXFrameworksBuildPhase; 56 | buildActionMask = 2147483647; 57 | files = ( 58 | CBF21DBF1710E5B000FCB91E /* UIKit.framework in Frameworks */, 59 | CBF21DC11710E5B000FCB91E /* Foundation.framework in Frameworks */, 60 | CBF21DC31710E5B000FCB91E /* CoreGraphics.framework in Frameworks */, 61 | F82428B394B54612AFA019DE /* libPods.a in Frameworks */, 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | CBF21DB21710E5B000FCB91E = { 69 | isa = PBXGroup; 70 | children = ( 71 | CB0790D71711973C00E4DD39 /* Person.h */, 72 | CB0790D81711973C00E4DD39 /* Person.m */, 73 | CBF21DC41710E5B000FCB91E /* Lua on iOS */, 74 | CBF21DBD1710E5B000FCB91E /* Frameworks */, 75 | CBF21DBC1710E5B000FCB91E /* Products */, 76 | F99505336E0F4F4A834663FE /* Pods.xcconfig */, 77 | ); 78 | sourceTree = ""; 79 | }; 80 | CBF21DBC1710E5B000FCB91E /* Products */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | CBF21DBB1710E5B000FCB91E /* Lua on iOS.app */, 84 | ); 85 | name = Products; 86 | sourceTree = ""; 87 | }; 88 | CBF21DBD1710E5B000FCB91E /* Frameworks */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | CBF21DBE1710E5B000FCB91E /* UIKit.framework */, 92 | CBF21DC01710E5B000FCB91E /* Foundation.framework */, 93 | CBF21DC21710E5B000FCB91E /* CoreGraphics.framework */, 94 | 26968ACD4C55486E99503630 /* libPods.a */, 95 | ); 96 | name = Frameworks; 97 | sourceTree = ""; 98 | }; 99 | CBF21DC41710E5B000FCB91E /* Lua on iOS */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | CBF21DCD1710E5B000FCB91E /* AppDelegate.h */, 103 | CBF21DCE1710E5B000FCB91E /* AppDelegate.m */, 104 | CBF21DD61710E5B000FCB91E /* MainStoryboard.storyboard */, 105 | CBF21DD91710E5B000FCB91E /* ViewController.h */, 106 | CBBEB7CB1710E7DA00006539 /* LuaManager.h */, 107 | CBBEB7CC1710E7DA00006539 /* LuaManager.m */, 108 | CBF21DDA1710E5B000FCB91E /* ViewController.m */, 109 | CBBEB7CE1710EAEC00006539 /* foo.lua */, 110 | CBF21DC51710E5B000FCB91E /* Supporting Files */, 111 | ); 112 | path = "Lua on iOS"; 113 | sourceTree = ""; 114 | }; 115 | CBF21DC51710E5B000FCB91E /* Supporting Files */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | CBF21DC61710E5B000FCB91E /* Lua on iOS-Info.plist */, 119 | CBF21DC71710E5B000FCB91E /* InfoPlist.strings */, 120 | CBF21DCA1710E5B000FCB91E /* main.m */, 121 | CBF21DCC1710E5B000FCB91E /* Lua on iOS-Prefix.pch */, 122 | CBF21DD01710E5B000FCB91E /* Default.png */, 123 | CBF21DD21710E5B000FCB91E /* Default@2x.png */, 124 | CBF21DD41710E5B000FCB91E /* Default-568h@2x.png */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | /* End PBXGroup section */ 130 | 131 | /* Begin PBXNativeTarget section */ 132 | CBF21DBA1710E5B000FCB91E /* Lua on iOS */ = { 133 | isa = PBXNativeTarget; 134 | buildConfigurationList = CBF21DDE1710E5B000FCB91E /* Build configuration list for PBXNativeTarget "Lua on iOS" */; 135 | buildPhases = ( 136 | CBF21DB71710E5B000FCB91E /* Sources */, 137 | CBF21DB81710E5B000FCB91E /* Frameworks */, 138 | CBF21DB91710E5B000FCB91E /* Resources */, 139 | 802AC6267E024FF38C3224C1 /* Copy Pods Resources */, 140 | ); 141 | buildRules = ( 142 | ); 143 | dependencies = ( 144 | ); 145 | name = "Lua on iOS"; 146 | productName = "Lua on iOS"; 147 | productReference = CBF21DBB1710E5B000FCB91E /* Lua on iOS.app */; 148 | productType = "com.apple.product-type.application"; 149 | }; 150 | /* End PBXNativeTarget section */ 151 | 152 | /* Begin PBXProject section */ 153 | CBF21DB31710E5B000FCB91E /* Project object */ = { 154 | isa = PBXProject; 155 | attributes = { 156 | LastUpgradeCheck = 0460; 157 | ORGANIZATIONNAME = "Maciej Konieczny"; 158 | }; 159 | buildConfigurationList = CBF21DB61710E5B000FCB91E /* Build configuration list for PBXProject "Lua on iOS" */; 160 | compatibilityVersion = "Xcode 3.2"; 161 | developmentRegion = English; 162 | hasScannedForEncodings = 0; 163 | knownRegions = ( 164 | en, 165 | ); 166 | mainGroup = CBF21DB21710E5B000FCB91E; 167 | productRefGroup = CBF21DBC1710E5B000FCB91E /* Products */; 168 | projectDirPath = ""; 169 | projectRoot = ""; 170 | targets = ( 171 | CBF21DBA1710E5B000FCB91E /* Lua on iOS */, 172 | ); 173 | }; 174 | /* End PBXProject section */ 175 | 176 | /* Begin PBXResourcesBuildPhase section */ 177 | CBF21DB91710E5B000FCB91E /* Resources */ = { 178 | isa = PBXResourcesBuildPhase; 179 | buildActionMask = 2147483647; 180 | files = ( 181 | CBF21DC91710E5B000FCB91E /* InfoPlist.strings in Resources */, 182 | CBF21DD11710E5B000FCB91E /* Default.png in Resources */, 183 | CBF21DD31710E5B000FCB91E /* Default@2x.png in Resources */, 184 | CBF21DD51710E5B000FCB91E /* Default-568h@2x.png in Resources */, 185 | CBF21DD81710E5B000FCB91E /* MainStoryboard.storyboard in Resources */, 186 | CBBEB7CF1710EAEC00006539 /* foo.lua in Resources */, 187 | ); 188 | runOnlyForDeploymentPostprocessing = 0; 189 | }; 190 | /* End PBXResourcesBuildPhase section */ 191 | 192 | /* Begin PBXShellScriptBuildPhase section */ 193 | 802AC6267E024FF38C3224C1 /* Copy Pods Resources */ = { 194 | isa = PBXShellScriptBuildPhase; 195 | buildActionMask = 2147483647; 196 | files = ( 197 | ); 198 | inputPaths = ( 199 | ); 200 | name = "Copy Pods Resources"; 201 | outputPaths = ( 202 | ); 203 | runOnlyForDeploymentPostprocessing = 0; 204 | shellPath = /bin/sh; 205 | shellScript = "\"${SRCROOT}/Pods/Pods-resources.sh\"\n"; 206 | }; 207 | /* End PBXShellScriptBuildPhase section */ 208 | 209 | /* Begin PBXSourcesBuildPhase section */ 210 | CBF21DB71710E5B000FCB91E /* Sources */ = { 211 | isa = PBXSourcesBuildPhase; 212 | buildActionMask = 2147483647; 213 | files = ( 214 | CBF21DCB1710E5B000FCB91E /* main.m in Sources */, 215 | CBF21DCF1710E5B000FCB91E /* AppDelegate.m in Sources */, 216 | CBF21DDB1710E5B000FCB91E /* ViewController.m in Sources */, 217 | CBBEB7CD1710E7DA00006539 /* LuaManager.m in Sources */, 218 | CB0790D91711973C00E4DD39 /* Person.m in Sources */, 219 | ); 220 | runOnlyForDeploymentPostprocessing = 0; 221 | }; 222 | /* End PBXSourcesBuildPhase section */ 223 | 224 | /* Begin PBXVariantGroup section */ 225 | CBF21DC71710E5B000FCB91E /* InfoPlist.strings */ = { 226 | isa = PBXVariantGroup; 227 | children = ( 228 | CBF21DC81710E5B000FCB91E /* en */, 229 | ); 230 | name = InfoPlist.strings; 231 | sourceTree = ""; 232 | }; 233 | CBF21DD61710E5B000FCB91E /* MainStoryboard.storyboard */ = { 234 | isa = PBXVariantGroup; 235 | children = ( 236 | CBF21DD71710E5B000FCB91E /* en */, 237 | ); 238 | name = MainStoryboard.storyboard; 239 | sourceTree = ""; 240 | }; 241 | /* End PBXVariantGroup section */ 242 | 243 | /* Begin XCBuildConfiguration section */ 244 | CBF21DDC1710E5B000FCB91E /* Debug */ = { 245 | isa = XCBuildConfiguration; 246 | buildSettings = { 247 | ALWAYS_SEARCH_USER_PATHS = NO; 248 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 249 | CLANG_CXX_LIBRARY = "libc++"; 250 | CLANG_ENABLE_OBJC_ARC = YES; 251 | CLANG_WARN_CONSTANT_CONVERSION = YES; 252 | CLANG_WARN_EMPTY_BODY = YES; 253 | CLANG_WARN_ENUM_CONVERSION = YES; 254 | CLANG_WARN_INT_CONVERSION = YES; 255 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 256 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 257 | COPY_PHASE_STRIP = NO; 258 | GCC_C_LANGUAGE_STANDARD = gnu99; 259 | GCC_DYNAMIC_NO_PIC = NO; 260 | GCC_OPTIMIZATION_LEVEL = 0; 261 | GCC_PREPROCESSOR_DEFINITIONS = ( 262 | "DEBUG=1", 263 | "$(inherited)", 264 | ); 265 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 266 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 267 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 268 | GCC_WARN_UNUSED_VARIABLE = YES; 269 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 270 | ONLY_ACTIVE_ARCH = YES; 271 | SDKROOT = iphoneos; 272 | }; 273 | name = Debug; 274 | }; 275 | CBF21DDD1710E5B000FCB91E /* Release */ = { 276 | isa = XCBuildConfiguration; 277 | buildSettings = { 278 | ALWAYS_SEARCH_USER_PATHS = NO; 279 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 280 | CLANG_CXX_LIBRARY = "libc++"; 281 | CLANG_ENABLE_OBJC_ARC = YES; 282 | CLANG_WARN_CONSTANT_CONVERSION = YES; 283 | CLANG_WARN_EMPTY_BODY = YES; 284 | CLANG_WARN_ENUM_CONVERSION = YES; 285 | CLANG_WARN_INT_CONVERSION = YES; 286 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 287 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 288 | COPY_PHASE_STRIP = YES; 289 | GCC_C_LANGUAGE_STANDARD = gnu99; 290 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 291 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 292 | GCC_WARN_UNUSED_VARIABLE = YES; 293 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 294 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 295 | SDKROOT = iphoneos; 296 | VALIDATE_PRODUCT = YES; 297 | }; 298 | name = Release; 299 | }; 300 | CBF21DDF1710E5B000FCB91E /* Debug */ = { 301 | isa = XCBuildConfiguration; 302 | baseConfigurationReference = F99505336E0F4F4A834663FE /* Pods.xcconfig */; 303 | buildSettings = { 304 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 305 | GCC_PREFIX_HEADER = "Lua on iOS/Lua on iOS-Prefix.pch"; 306 | INFOPLIST_FILE = "Lua on iOS/Lua on iOS-Info.plist"; 307 | PRODUCT_NAME = "$(TARGET_NAME)"; 308 | WRAPPER_EXTENSION = app; 309 | }; 310 | name = Debug; 311 | }; 312 | CBF21DE01710E5B000FCB91E /* Release */ = { 313 | isa = XCBuildConfiguration; 314 | baseConfigurationReference = F99505336E0F4F4A834663FE /* Pods.xcconfig */; 315 | buildSettings = { 316 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 317 | GCC_PREFIX_HEADER = "Lua on iOS/Lua on iOS-Prefix.pch"; 318 | INFOPLIST_FILE = "Lua on iOS/Lua on iOS-Info.plist"; 319 | PRODUCT_NAME = "$(TARGET_NAME)"; 320 | WRAPPER_EXTENSION = app; 321 | }; 322 | name = Release; 323 | }; 324 | /* End XCBuildConfiguration section */ 325 | 326 | /* Begin XCConfigurationList section */ 327 | CBF21DB61710E5B000FCB91E /* Build configuration list for PBXProject "Lua on iOS" */ = { 328 | isa = XCConfigurationList; 329 | buildConfigurations = ( 330 | CBF21DDC1710E5B000FCB91E /* Debug */, 331 | CBF21DDD1710E5B000FCB91E /* Release */, 332 | ); 333 | defaultConfigurationIsVisible = 0; 334 | defaultConfigurationName = Release; 335 | }; 336 | CBF21DDE1710E5B000FCB91E /* Build configuration list for PBXNativeTarget "Lua on iOS" */ = { 337 | isa = XCConfigurationList; 338 | buildConfigurations = ( 339 | CBF21DDF1710E5B000FCB91E /* Debug */, 340 | CBF21DE01710E5B000FCB91E /* Release */, 341 | ); 342 | defaultConfigurationIsVisible = 0; 343 | defaultConfigurationName = Release; 344 | }; 345 | /* End XCConfigurationList section */ 346 | }; 347 | rootObject = CBF21DB31710E5B000FCB91E /* Project object */; 348 | } 349 | -------------------------------------------------------------------------------- /Lua on iOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Lua on iOS.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lua on iOS/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Lua on iOS 4 | // 5 | 6 | #import 7 | 8 | @interface AppDelegate : UIResponder 9 | 10 | @property (strong, nonatomic) UIWindow *window; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /Lua on iOS/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Lua on iOS 4 | // 5 | 6 | #import "AppDelegate.h" 7 | 8 | @implementation AppDelegate 9 | 10 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 11 | { 12 | // Override point for customization after application launch. 13 | return YES; 14 | } 15 | 16 | - (void)applicationWillResignActive:(UIApplication *)application 17 | { 18 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 19 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 20 | } 21 | 22 | - (void)applicationDidEnterBackground:(UIApplication *)application 23 | { 24 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 25 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 26 | } 27 | 28 | - (void)applicationWillEnterForeground:(UIApplication *)application 29 | { 30 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 31 | } 32 | 33 | - (void)applicationDidBecomeActive:(UIApplication *)application 34 | { 35 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 36 | } 37 | 38 | - (void)applicationWillTerminate:(UIApplication *)application 39 | { 40 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Lua on iOS/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/narfdotpl/lua-on-ios/23ed8389c719c9a3b8a5c415b908d0b520e60682/Lua on iOS/Default-568h@2x.png -------------------------------------------------------------------------------- /Lua on iOS/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/narfdotpl/lua-on-ios/23ed8389c719c9a3b8a5c415b908d0b520e60682/Lua on iOS/Default.png -------------------------------------------------------------------------------- /Lua on iOS/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/narfdotpl/lua-on-ios/23ed8389c719c9a3b8a5c415b908d0b520e60682/Lua on iOS/Default@2x.png -------------------------------------------------------------------------------- /Lua on iOS/Lua on iOS-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | pl.narf.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | MainStoryboard 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Lua on iOS/Lua on iOS-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Lua on iOS' target in the 'Lua on iOS' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_5_0 8 | #warning "This project uses features only available in iOS SDK 5.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /Lua on iOS/LuaManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // LuaManager.h 3 | // Lua on iOS 4 | // 5 | 6 | #import 7 | 8 | #include "lua.h" 9 | #include "lualib.h" 10 | #include "lauxlib.h" 11 | 12 | 13 | @interface LuaManager : NSObject 14 | 15 | - (void)runCodeFromString:(NSString *)code; 16 | - (void)runCodeFromFileWithPath:(NSString *)path; 17 | - (void)registerFunction:(lua_CFunction)function withName:(NSString *)name; 18 | - (void)callFunctionNamed:(NSString *)name withObject:(NSObject *)object; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Lua on iOS/LuaManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // LuaManager.m 3 | // Lua on iOS 4 | // 5 | 6 | #import "LuaManager.h" 7 | 8 | #define to_cString(s) ([s cStringUsingEncoding:[NSString defaultCStringEncoding]]) 9 | 10 | 11 | @interface LuaManager () 12 | 13 | @property (nonatomic) lua_State *state; 14 | 15 | @end 16 | 17 | 18 | @implementation LuaManager 19 | 20 | - (lua_State *)state { 21 | if (!_state) { 22 | _state = luaL_newstate(); 23 | luaL_openlibs(_state); 24 | lua_settop(_state, 0); 25 | } 26 | 27 | return _state; 28 | } 29 | 30 | - (void)runCodeFromString:(NSString *)code { 31 | // get state 32 | lua_State *L = self.state; 33 | 34 | // compile 35 | int error = luaL_loadstring(L, to_cString(code)); 36 | if (error) { 37 | luaL_error(L, "cannot compile Lua code: %s", lua_tostring(L, -1)); 38 | return; 39 | } 40 | 41 | // run 42 | error = lua_pcall(L, 0, 0, 0); 43 | if (error) { 44 | luaL_error(L, "cannot run Lua code: %s", lua_tostring(L, -1)); 45 | return; 46 | } 47 | } 48 | 49 | - (void)runCodeFromFileWithPath:(NSString *)path { 50 | // get state 51 | lua_State *L = self.state; 52 | 53 | // compile 54 | int error = luaL_loadfile(L, to_cString(path)); 55 | if (error) { 56 | luaL_error(L, "cannot compile Lua file: %s", lua_tostring(L, -1)); 57 | return; 58 | } 59 | 60 | // run 61 | error = lua_pcall(L, 0, 0, 0); 62 | if (error) { 63 | luaL_error(L, "cannot run Lua code: %s", lua_tostring(L, -1)); 64 | return; 65 | } 66 | } 67 | 68 | - (void)registerFunction:(lua_CFunction)function withName:(NSString *)name { 69 | lua_register(self.state, to_cString(name), function); 70 | } 71 | 72 | - (void)callFunctionNamed:(NSString *)name withObject:(NSObject *)object { 73 | // get state 74 | lua_State *L = self.state; 75 | 76 | // prepare for "function(object)" 77 | lua_getglobal(L, to_cString(name)); 78 | lua_pushlightuserdata(L, (__bridge void *)(object)); 79 | 80 | // run 81 | int error = lua_pcall(L, 1, 0, 0); 82 | if (error) { 83 | luaL_error(L, "cannot run Lua code: %s", lua_tostring(L, -1)); 84 | return; 85 | } 86 | } 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /Lua on iOS/Person.h: -------------------------------------------------------------------------------- 1 | // 2 | // Person.h 3 | // Lua on iOS 4 | // 5 | 6 | #import 7 | #import "LuaManager.h" 8 | 9 | 10 | int l_set_person_name(lua_State *L); 11 | 12 | 13 | @interface Person : NSObject 14 | 15 | @property (strong, nonatomic) NSString *name; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Lua on iOS/Person.m: -------------------------------------------------------------------------------- 1 | // 2 | // Person.m 3 | // Lua on iOS 4 | // 5 | 6 | #import "Person.h" 7 | 8 | 9 | int l_set_person_name(lua_State *L) { 10 | // get arguments 11 | Person *person = (__bridge Person *)lua_touserdata(L, 1); 12 | NSString *name = [NSString stringWithUTF8String:lua_tostring(L, 2)]; 13 | 14 | // set name 15 | person.name = name; 16 | 17 | // return nothing 18 | return 0; 19 | } 20 | 21 | 22 | @implementation Person 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Lua on iOS/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // Lua on iOS 4 | // 5 | 6 | #import 7 | 8 | 9 | @interface ViewController : UIViewController 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /Lua on iOS/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // Lua on iOS 4 | // 5 | 6 | #import "ViewController.h" 7 | #import "LuaManager.h" 8 | #import "Person.h" 9 | 10 | 11 | // let's prefix `lua_CFunctions` with `l_` as in http://www.lua.org/pil/26.1.html 12 | int l_sum(lua_State *L) { 13 | // get arguments (`int numberOfArguments = lua_gettop(L)`) 14 | double x = lua_tonumber(L, 1); 15 | double y = lua_tonumber(L, 2); 16 | 17 | // compute result 18 | double result = x + y; 19 | 20 | // return one result 21 | lua_pushnumber(L, result); 22 | return 1; 23 | } 24 | 25 | 26 | @interface ViewController () 27 | 28 | @end 29 | 30 | 31 | @implementation ViewController 32 | 33 | - (void)viewDidLoad { 34 | [super viewDidLoad]; 35 | 36 | // create a manager 37 | LuaManager *m = [[LuaManager alloc] init]; 38 | 39 | // run sth simple 40 | [m runCodeFromString:@"print(2 + 2)"]; 41 | 42 | // maintain state 43 | [m runCodeFromString:@"x = 0"]; 44 | [m runCodeFromString:@"print(x + 1)"]; 45 | 46 | // run file 47 | NSString *path = [[NSBundle mainBundle] pathForResource:@"foo" ofType:@"lua"]; 48 | [m runCodeFromFileWithPath:path]; 49 | 50 | // call objc function from lua 51 | [m registerFunction:l_sum withName:@"sum"]; 52 | [m runCodeFromString:@"print(sum(1, 2))"]; 53 | 54 | // create a person called Alice 55 | Person *person = [[Person alloc] init]; 56 | person.name = @"Alice"; 57 | NSLog(@"Person's name is %@.", person.name); 58 | 59 | // rename person to Bob 60 | [m registerFunction:l_set_person_name withName:@"set_person_name"]; 61 | [m callFunctionNamed:@"set_person_name_to_bob" withObject:person]; 62 | NSLog(@"Person's name is %@.", person.name); 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Lua on iOS/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Lua on iOS/en.lproj/MainStoryboard.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Lua on iOS/foo.lua: -------------------------------------------------------------------------------- 1 | function set_person_name_to_bob(person) 2 | set_person_name(person, "Bob") 3 | end 4 | 5 | 6 | print("file is executed on load") 7 | -------------------------------------------------------------------------------- /Lua on iOS/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Lua on iOS 4 | // 5 | 6 | #import 7 | 8 | #import "AppDelegate.h" 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | @autoreleasepool { 13 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '6.1' 2 | 3 | pod 'lua', '5.2.1' 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Lua on iOS 2 | ========== 3 | 4 | A sequence of clear commits showing how to add Lua to an empty iOS app. 5 | 6 | Written in early 2013 (Lua 5.2, Xcode 4.6, iOS 6.1). Based on parts 7 | [two][] and [three][] of James Norton's "Scripting iOS Games With Lua". 8 | Released into the public domain. 9 | 10 | [two]: http://blog.stokedsoftware.com/blog/2012/02/05/scripting-ios-games-with-lua-part-ii/ 11 | [three]: http://blog.stokedsoftware.com/blog/2012/02/06/scripting-ios-games-with-lua-part-iii/ 12 | 13 | 14 | Levels of integration 15 | --------------------- 16 | 17 | Each step is covered in a separate commit. 18 | 19 | 1. [Run Lua code from a string][c1]. 20 | 2. [Maintain interpreter's state between calls][c2]. 21 | 3. [Run Lua code from a file][c3]. 22 | 4. [Call an Objective-C function from Lua][c4]. 23 | 5. [Pass to Lua a pointer to an Objective-C object][c5]. 24 | 25 | [c1]: https://github.com/narfdotpl/lua-on-ios/commit/ae7b77e 26 | [c2]: https://github.com/narfdotpl/lua-on-ios/commit/c485794 27 | [c3]: https://github.com/narfdotpl/lua-on-ios/commit/b3887e7 28 | [c4]: https://github.com/narfdotpl/lua-on-ios/commit/5b6fcb6 29 | [c5]: https://github.com/narfdotpl/lua-on-ios/commit/804e1a1 30 | 31 | 32 | How to test this? 33 | ----------------- 34 | 35 | 1. Install [CocoaPods](http://cocoapods.org/). 36 | 2. `git clone https://github.com/narfdotpl/lua-on-ios.git` 37 | 3. `cd lua-on-ios` 38 | 4. `pod install` 39 | 5. `open *.xcworkspace` 40 | 6. Build and run. 41 | --------------------------------------------------------------------------------