This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- from http://stackoverflow.com/questions/132397/get-back-the-output-of-os-execute-in-lua | |
| function os.capture(cmd, raw) | |
| local f = assert(io.popen(cmd, 'r')) | |
| local s = assert(f:read('*a')) | |
| f:close() | |
| if raw then return s end | |
| s = string.gsub(s, '^%s+', '') | |
| s = string.gsub(s, '%s+$', '') | |
| s = string.gsub(s, '[\n\r]+', ' ') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pcall(require,"socket") | |
| local coroutine_scheduler = { | |
| _NAME = "coroutine_scheduler.lua" | |
| _VERSION = "1.0.0", | |
| } | |
| local Scheduler | |
| do Scheduler = setmetatable({}, { | |
| __call = function(class) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| urlencode() { | |
| # urlencode <string> | |
| old_lc_collate=$LC_COLLATE | |
| LC_COLLATE=C | |
| local length="${#1}" | |
| for (( i = 0; i < length; i++ )); do | |
| local c="${1:$i:1}" | |
| case $c in |
NewerOlder