{"action":"created","issue":{"url":"https://api.github.com/repos/opentx/opentx/issues/3110","labels_url":"https://api.github.com/repos/opentx/opentx/issues/3110/labels{/name}","comments_url":"https://api.github.com/repos/opentx/opentx/issues/3110/comments","events_url":"https://api.github.com/repos/opentx/opentx/issues/3110/events","html_url":"https://github.com/opentx/opentx/issues/3110","id":119013732,"number":3110,"title":"[LUA] inconsistent implementation of io.read(...), io.write(...) and io.flush()","user":{"login":"Sacre100","id":8712977,"avatar_url":"https://avatars.githubusercontent.com/u/8712977?v=3","gravatar_id":"","url":"https://api.github.com/users/Sacre100","html_url":"https://github.com/Sacre100","followers_url":"https://api.github.com/users/Sacre100/followers","following_url":"https://api.github.com/users/Sacre100/following{/other_user}","gists_url":"https://api.github.com/users/Sacre100/gists{/gist_id}","starred_url":"https://api.github.com/users/Sacre100/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sacre100/subscriptions","organizations_url":"https://api.github.com/users/Sacre100/orgs","repos_url":"https://api.github.com/users/Sacre100/repos","events_url":"https://api.github.com/users/Sacre100/events{/privacy}","received_events_url":"https://api.github.com/users/Sacre100/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-11-26T10:23:16Z","updated_at":"2015-11-26T15:31:27Z","closed_at":"2015-11-26T13:20:20Z","body":"Following code succeed in LUA 5.2 using ZeroBrainStudio but fail in OpenTx.\r\n\r\n    local f = io.open(\"my-file.txt\")\r\n    local s = f:read(20)  -- or f.read(f, 20) which is the same\r\n    io.close(f)\r\n\r\nFollowing code succeed in OpenTx but fail in LUA 5.2 using ZeroBrainStudio. \r\n\r\n    local f = io.open(\"my-file.txt\")\r\n    local s = io.read(f, 20)\r\n    io.close(f)\r\n\r\nIn LUA 5.2, io.read(...) is equivalent to io.input():read(···)  (see documentation http://www.lua.org/manual/5.2/manual.html#pdf-io.read ) and not a function to read data from a file.\r\n\r\nSame for io.write(...) which is equivalent to io.output():write(···) (see http://www.lua.org/manual/5.2/manual.html#pdf-io.write)\r\n\r\nAnd for io.flush() which is equivalent to io.output():flush() (see http://www.lua.org/manual/5.2/manual.html#pdf-io.flush)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/opentx/opentx/issues/comments/159938934","html_url":"https://github.com/opentx/opentx/issues/3110#issuecomment-159938934","issue_url":"https://api.github.com/repos/opentx/opentx/issues/3110","id":159938934,"user":{"login":"kilrah","id":6065069,"avatar_url":"https://avatars.githubusercontent.com/u/6065069?v=3","gravatar_id":"","url":"https://api.github.com/users/kilrah","html_url":"https://github.com/kilrah","followers_url":"https://api.github.com/users/kilrah/followers","following_url":"https://api.github.com/users/kilrah/following{/other_user}","gists_url":"https://api.github.com/users/kilrah/gists{/gist_id}","starred_url":"https://api.github.com/users/kilrah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kilrah/subscriptions","organizations_url":"https://api.github.com/users/kilrah/orgs","repos_url":"https://api.github.com/users/kilrah/repos","events_url":"https://api.github.com/users/kilrah/events{/privacy}","received_events_url":"https://api.github.com/users/kilrah/received_events","type":"User","site_admin":false},"created_at":"2015-11-26T15:31:27Z","updated_at":"2015-11-26T15:31:27Z","body":"If you try to reuse code that uses a library that isn't in OpenTX it won't work either...\r\n\r\nNot all libs are included, and similarly when there are multiple ways to do the same thing not all have been included.  "}}