     {
         if status == LUA_ERRSYNTAX {
             var lmsg: size_t = 0
-            let msg = NSString(CString: lua_tolstring(self.L, -1, &lmsg), encoding: NSASCIIStringEncoding)!
+            let msg = NSString(cString: lua_tolstring(self.L, -1, &lmsg), encoding: String.Encoding.ascii.rawValue)!
             if msg.hasSuffix(EOFMARK) {
                 lua_pop(self.L, 1)
                 return true

    
    
    
    private func processLine(var script: String)
    {
        let n = lua_gettop(self.L)
        
        script = script.stringByTrimmingCharactersInSet(RETURN_CHARSET)
        
        // legacy handling from Lua 5.2
        if n == 0 && script.hasPrefix("=") {
            let afterEqualsIndex = script.startIndex.successor()
            script = "return " + script.substringFromIndex(afterEqualsIndex)
        }
        lua_pushstring(self.L, script.cStringUsingEncoding(NSASCIIStringEncoding)!)
        
        // If we already have the start of a Lua command, combine our new
        // input with what was leftover.

    
    func compileWithReturn() -> Int32
    {
        let line = NSString(cString: lua_tolstring(self.L, -1, nil), encoding: String.Encoding.ascii.rawValue)
        if let lline = line {
            if !lline.hasPrefix("return ") {
                let newInput = NSString(format: "return %@", lline)
                lua_pushstring(self.L, newInput.cString(using: String.Encoding.ascii.rawValue))
            }
        }
 
