Updated Penlight to latest.
Updated SubLua to latest. Upreved for release.
This commit is contained in:
parent
b9483ad9f2
commit
dbd62061bd
@ -25,8 +25,8 @@
|
|||||||
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
; -- General Installer configuration
|
; -- General Installer configuration
|
||||||
#define MyAppVer "5.1.4.47"
|
#define MyAppVer "5.1.4.48"
|
||||||
#define MyAppDisplayVer "5.1.4-47"
|
#define MyAppDisplayVer "5.1.4-48"
|
||||||
#define MyAppName "Lua"
|
#define MyAppName "Lua"
|
||||||
#define MyAppDisplayName "Lua for Windows"
|
#define MyAppDisplayName "Lua for Windows"
|
||||||
#define MyAppPublisher "The Lua for Windows Project and Lua and Tecgraf, PUC-Rio"
|
#define MyAppPublisher "The Lua for Windows Project and Lua and Tecgraf, PUC-Rio"
|
||||||
|
@ -75,6 +75,7 @@ C header files/libraries/etc. for building C module
|
|||||||
|[Oil](http://oil.luaforge.net)|0.4-beta| It is a simple, efficient and flexible object request broker written in the Lua language.|
|
|[Oil](http://oil.luaforge.net)|0.4-beta| It is a simple, efficient and flexible object request broker written in the Lua language.|
|
||||||
|[LuaJSON](http://github.com/harningt/luajson)|1.2.2| JSON parser/encoder for Lua Parses JSON using LPEG for speed and flexibility. Depending on parser/encoder options, various values are preserved as best as possible.|
|
|[LuaJSON](http://github.com/harningt/luajson)|1.2.2| JSON parser/encoder for Lua Parses JSON using LPEG for speed and flexibility. Depending on parser/encoder options, various values are preserved as best as possible.|
|
||||||
|[SubLua](https://sourceforge.net/projects/subcpp/)|1.8.10| Subversion binding.|
|
|[SubLua](https://sourceforge.net/projects/subcpp/)|1.8.10| Subversion binding.|
|
||||||
|
|[30Log](https://github.com/Yonaba/30log)|1.0.0| 30 lines library for object orientation in Lua.|
|
||||||
|
|
||||||
## History ##
|
## History ##
|
||||||
|
|
||||||
@ -279,3 +280,7 @@ C header files/libraries/etc. for building C module
|
|||||||
* Updated Penlight to 1.3.2.
|
* Updated Penlight to 1.3.2.
|
||||||
* Updated SubLua to 1.8.10.
|
* Updated SubLua to 1.8.10.
|
||||||
* **WARNING**: Moved all downloads and code hosting to GitHub. Older releases will not function when Google Code is shut down. Make sure to upgrade.
|
* **WARNING**: Moved all downloads and code hosting to GitHub. Older releases will not function when Google Code is shut down. Make sure to upgrade.
|
||||||
|
|
||||||
|
**5.1.4-48** 16/September/2015 - 34rd release
|
||||||
|
* Added 30Log v1.0.0 - 30 lines library for object orientation in Lua
|
||||||
|
* Updated SubLua to 1.8.11.
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
=================== Lua For Windows ===================
|
=================== Lua For Windows ===================
|
||||||
|
09/16/2015 Version 5.1.4-48
|
||||||
|
+ Added 30Log v1.0.0 - 30 lines library for object orientation in Lua
|
||||||
|
^ Updated SubLua to 1.8.11.
|
||||||
|
|
||||||
03/18/2015 Version 5.1.4-47
|
03/18/2015 Version 5.1.4-47
|
||||||
^ Updated stdlib to release 28.
|
^ Updated stdlib to release 28.
|
||||||
^ Updated Penlight to 1.3.2.
|
^ Updated Penlight to 1.3.2.
|
||||||
|
Binary file not shown.
0
files/docs/SubLua/ldoc.lua
Normal file → Executable file
0
files/docs/SubLua/ldoc.lua
Normal file → Executable file
@ -1,137 +1,137 @@
|
|||||||
----------------
|
----------------
|
||||||
--- Lua 5.1/5.2 compatibility
|
--- Lua 5.1/5.2 compatibility
|
||||||
-- Ensures that `table.pack` and `package.searchpath` are available
|
-- Ensures that `table.pack` and `package.searchpath` are available
|
||||||
-- for Lua 5.1 and LuaJIT.
|
-- for Lua 5.1 and LuaJIT.
|
||||||
-- The exported function `load` is Lua 5.2 compatible.
|
-- The exported function `load` is Lua 5.2 compatible.
|
||||||
-- `compat.setfenv` and `compat.getfenv` are available for Lua 5.2, although
|
-- `compat.setfenv` and `compat.getfenv` are available for Lua 5.2, although
|
||||||
-- they are not always guaranteed to work.
|
-- they are not always guaranteed to work.
|
||||||
-- @module pl.compat
|
-- @module pl.compat
|
||||||
|
|
||||||
local compat = {}
|
local compat = {}
|
||||||
|
|
||||||
compat.lua51 = _VERSION == 'Lua 5.1'
|
compat.lua51 = _VERSION == 'Lua 5.1'
|
||||||
|
|
||||||
--- execute a shell command.
|
--- execute a shell command.
|
||||||
-- This is a compatibility function that returns the same for Lua 5.1 and Lua 5.2
|
-- This is a compatibility function that returns the same for Lua 5.1 and Lua 5.2
|
||||||
-- @param cmd a shell command
|
-- @param cmd a shell command
|
||||||
-- @return true if successful
|
-- @return true if successful
|
||||||
-- @return actual return code
|
-- @return actual return code
|
||||||
function compat.execute (cmd)
|
function compat.execute (cmd)
|
||||||
local res1,res2,res2 = os.execute(cmd)
|
local res1,res2,res2 = os.execute(cmd)
|
||||||
if compat.lua51 then
|
if compat.lua51 then
|
||||||
return res1==0,res1
|
return res1==0,res1
|
||||||
else
|
else
|
||||||
return not not res1,res2
|
return not not res1,res2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
-- Load Lua code as a text or binary chunk.
|
-- Load Lua code as a text or binary chunk.
|
||||||
-- @param ld code string or loader
|
-- @param ld code string or loader
|
||||||
-- @param[opt] source name of chunk for errors
|
-- @param[opt] source name of chunk for errors
|
||||||
-- @param[opt] mode 'b', 't' or 'bt'
|
-- @param[opt] mode 'b', 't' or 'bt'
|
||||||
-- @param[opt] env environment to load the chunk in
|
-- @param[opt] env environment to load the chunk in
|
||||||
-- @function compat.load
|
-- @function compat.load
|
||||||
|
|
||||||
---------------
|
---------------
|
||||||
-- Get environment of a function.
|
-- Get environment of a function.
|
||||||
-- With Lua 5.2, may return nil for a function with no global references!
|
-- With Lua 5.2, may return nil for a function with no global references!
|
||||||
-- Based on code by [Sergey Rozhenko](http://lua-users.org/lists/lua-l/2010-06/msg00313.html)
|
-- Based on code by [Sergey Rozhenko](http://lua-users.org/lists/lua-l/2010-06/msg00313.html)
|
||||||
-- @param f a function or a call stack reference
|
-- @param f a function or a call stack reference
|
||||||
-- @function compat.setfenv
|
-- @function compat.setfenv
|
||||||
|
|
||||||
---------------
|
---------------
|
||||||
-- Set environment of a function
|
-- Set environment of a function
|
||||||
-- @param f a function or a call stack reference
|
-- @param f a function or a call stack reference
|
||||||
-- @param env a table that becomes the new environment of `f`
|
-- @param env a table that becomes the new environment of `f`
|
||||||
-- @function compat.setfenv
|
-- @function compat.setfenv
|
||||||
|
|
||||||
if compat.lua51 then -- define Lua 5.2 style load()
|
if compat.lua51 then -- define Lua 5.2 style load()
|
||||||
if not tostring(assert):match 'builtin' then -- but LuaJIT's load _is_ compatible
|
if not tostring(assert):match 'builtin' then -- but LuaJIT's load _is_ compatible
|
||||||
local lua51_load = load
|
local lua51_load = load
|
||||||
function compat.load(str,src,mode,env)
|
function compat.load(str,src,mode,env)
|
||||||
local chunk,err
|
local chunk,err
|
||||||
if type(str) == 'string' then
|
if type(str) == 'string' then
|
||||||
if str:byte(1) == 27 and not (mode or 'bt'):find 'b' then
|
if str:byte(1) == 27 and not (mode or 'bt'):find 'b' then
|
||||||
return nil,"attempt to load a binary chunk"
|
return nil,"attempt to load a binary chunk"
|
||||||
end
|
end
|
||||||
chunk,err = loadstring(str,src)
|
chunk,err = loadstring(str,src)
|
||||||
else
|
else
|
||||||
chunk,err = lua51_load(str,src)
|
chunk,err = lua51_load(str,src)
|
||||||
end
|
end
|
||||||
if chunk and env then setfenv(chunk,env) end
|
if chunk and env then setfenv(chunk,env) end
|
||||||
return chunk,err
|
return chunk,err
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
compat.load = load
|
compat.load = load
|
||||||
end
|
end
|
||||||
compat.setfenv, compat.getfenv = setfenv, getfenv
|
compat.setfenv, compat.getfenv = setfenv, getfenv
|
||||||
else
|
else
|
||||||
compat.load = load
|
compat.load = load
|
||||||
-- setfenv/getfenv replacements for Lua 5.2
|
-- setfenv/getfenv replacements for Lua 5.2
|
||||||
-- by Sergey Rozhenko
|
-- by Sergey Rozhenko
|
||||||
-- http://lua-users.org/lists/lua-l/2010-06/msg00313.html
|
-- http://lua-users.org/lists/lua-l/2010-06/msg00313.html
|
||||||
-- Roberto Ierusalimschy notes that it is possible for getfenv to return nil
|
-- Roberto Ierusalimschy notes that it is possible for getfenv to return nil
|
||||||
-- in the case of a function with no globals:
|
-- in the case of a function with no globals:
|
||||||
-- http://lua-users.org/lists/lua-l/2010-06/msg00315.html
|
-- http://lua-users.org/lists/lua-l/2010-06/msg00315.html
|
||||||
function compat.setfenv(f, t)
|
function compat.setfenv(f, t)
|
||||||
f = (type(f) == 'function' and f or debug.getinfo(f + 1, 'f').func)
|
f = (type(f) == 'function' and f or debug.getinfo(f + 1, 'f').func)
|
||||||
local name
|
local name
|
||||||
local up = 0
|
local up = 0
|
||||||
repeat
|
repeat
|
||||||
up = up + 1
|
up = up + 1
|
||||||
name = debug.getupvalue(f, up)
|
name = debug.getupvalue(f, up)
|
||||||
until name == '_ENV' or name == nil
|
until name == '_ENV' or name == nil
|
||||||
if name then
|
if name then
|
||||||
debug.upvaluejoin(f, up, function() return name end, 1) -- use unique upvalue
|
debug.upvaluejoin(f, up, function() return name end, 1) -- use unique upvalue
|
||||||
debug.setupvalue(f, up, t)
|
debug.setupvalue(f, up, t)
|
||||||
end
|
end
|
||||||
if f ~= 0 then return f end
|
if f ~= 0 then return f end
|
||||||
end
|
end
|
||||||
|
|
||||||
function compat.getfenv(f)
|
function compat.getfenv(f)
|
||||||
local f = f or 0
|
local f = f or 0
|
||||||
f = (type(f) == 'function' and f or debug.getinfo(f + 1, 'f').func)
|
f = (type(f) == 'function' and f or debug.getinfo(f + 1, 'f').func)
|
||||||
local name, val
|
local name, val
|
||||||
local up = 0
|
local up = 0
|
||||||
repeat
|
repeat
|
||||||
up = up + 1
|
up = up + 1
|
||||||
name, val = debug.getupvalue(f, up)
|
name, val = debug.getupvalue(f, up)
|
||||||
until name == '_ENV' or name == nil
|
until name == '_ENV' or name == nil
|
||||||
return val
|
return val
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Lua 5.2 Functions Available for 5.1
|
--- Lua 5.2 Functions Available for 5.1
|
||||||
-- @section lua52
|
-- @section lua52
|
||||||
|
|
||||||
--- pack an argument list into a table.
|
--- pack an argument list into a table.
|
||||||
-- @param ... any arguments
|
-- @param ... any arguments
|
||||||
-- @return a table with field n set to the length
|
-- @return a table with field n set to the length
|
||||||
-- @return the length
|
-- @return the length
|
||||||
-- @function table.pack
|
-- @function table.pack
|
||||||
if not table.pack then
|
if not table.pack then
|
||||||
function table.pack (...)
|
function table.pack (...)
|
||||||
return {n=select('#',...); ...}
|
return {n=select('#',...); ...}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
------
|
------
|
||||||
-- return the full path where a Lua module name would be matched.
|
-- return the full path where a Lua module name would be matched.
|
||||||
-- @param mod module name, possibly dotted
|
-- @param mod module name, possibly dotted
|
||||||
-- @param path a path in the same form as package.path or package.cpath
|
-- @param path a path in the same form as package.path or package.cpath
|
||||||
-- @see path.package_path
|
-- @see path.package_path
|
||||||
-- @function package.searchpath
|
-- @function package.searchpath
|
||||||
if not package.searchpath then
|
if not package.searchpath then
|
||||||
local sep = package.config:sub(1,1)
|
local sep = package.config:sub(1,1)
|
||||||
function package.searchpath (mod,path)
|
function package.searchpath (mod,path)
|
||||||
mod = mod:gsub('%.',sep)
|
mod = mod:gsub('%.',sep)
|
||||||
for m in path:gmatch('[^;]+') do
|
for m in path:gmatch('[^;]+') do
|
||||||
local nm = m:gsub('?',mod)
|
local nm = m:gsub('?',mod)
|
||||||
local f = io.open(nm,'r')
|
local f = io.open(nm,'r')
|
||||||
if f then f:close(); return nm end
|
if f then f:close(); return nm end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return compat
|
return compat
|
||||||
|
@ -1,143 +1,143 @@
|
|||||||
---- Dealing with Detailed Type Information
|
---- Dealing with Detailed Type Information
|
||||||
|
|
||||||
-- Dependencies `pl.utils`
|
-- Dependencies `pl.utils`
|
||||||
-- @module pl.types
|
-- @module pl.types
|
||||||
|
|
||||||
local utils = require 'pl.utils'
|
local utils = require 'pl.utils'
|
||||||
local types = {}
|
local types = {}
|
||||||
|
|
||||||
--- is the object either a function or a callable object?.
|
--- is the object either a function or a callable object?.
|
||||||
-- @param obj Object to check.
|
-- @param obj Object to check.
|
||||||
function types.is_callable (obj)
|
function types.is_callable (obj)
|
||||||
return type(obj) == 'function' or getmetatable(obj) and getmetatable(obj).__call
|
return type(obj) == 'function' or getmetatable(obj) and getmetatable(obj).__call
|
||||||
end
|
end
|
||||||
|
|
||||||
--- is the object of the specified type?.
|
--- is the object of the specified type?.
|
||||||
-- If the type is a string, then use type, otherwise compare with metatable
|
-- If the type is a string, then use type, otherwise compare with metatable
|
||||||
-- @param obj An object to check
|
-- @param obj An object to check
|
||||||
-- @param tp String of what type it should be
|
-- @param tp String of what type it should be
|
||||||
-- @function is_type
|
-- @function is_type
|
||||||
types.is_type = utils.is_type
|
types.is_type = utils.is_type
|
||||||
|
|
||||||
local fileMT = getmetatable(io.stdout)
|
local fileMT = getmetatable(io.stdout)
|
||||||
|
|
||||||
--- a string representation of a type.
|
--- a string representation of a type.
|
||||||
-- For tables with metatables, we assume that the metatable has a `_name`
|
-- For tables with metatables, we assume that the metatable has a `_name`
|
||||||
-- field. Knows about Lua file objects.
|
-- field. Knows about Lua file objects.
|
||||||
-- @param obj an object
|
-- @param obj an object
|
||||||
-- @return a string like 'number', 'table' or 'List'
|
-- @return a string like 'number', 'table' or 'List'
|
||||||
function types.type (obj)
|
function types.type (obj)
|
||||||
local t = type(obj)
|
local t = type(obj)
|
||||||
if t == 'table' or t == 'userdata' then
|
if t == 'table' or t == 'userdata' then
|
||||||
local mt = getmetatable(obj)
|
local mt = getmetatable(obj)
|
||||||
if mt == fileMT then
|
if mt == fileMT then
|
||||||
return 'file'
|
return 'file'
|
||||||
else
|
else
|
||||||
return mt._name or "unknown "..t
|
return mt._name or "unknown "..t
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return t
|
return t
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- is this number an integer?
|
--- is this number an integer?
|
||||||
-- @param x a number
|
-- @param x a number
|
||||||
-- @raise error if x is not a number
|
-- @raise error if x is not a number
|
||||||
function types.is_integer (x)
|
function types.is_integer (x)
|
||||||
return math.ceil(x)==x
|
return math.ceil(x)==x
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Check if the object is "empty".
|
--- Check if the object is "empty".
|
||||||
-- An object is considered empty if it is nil, a table with out any items (key,
|
-- An object is considered empty if it is nil, a table with out any items (key,
|
||||||
-- value pairs or indexes), or a string with no content ("").
|
-- value pairs or indexes), or a string with no content ("").
|
||||||
-- @param o The object to check if it is empty.
|
-- @param o The object to check if it is empty.
|
||||||
-- @param ignore_spaces If the object is a string and this is true the string is
|
-- @param ignore_spaces If the object is a string and this is true the string is
|
||||||
-- considered empty is it only contains spaces.
|
-- considered empty is it only contains spaces.
|
||||||
-- @return true if the object is empty, otherwise false.
|
-- @return true if the object is empty, otherwise false.
|
||||||
function types.is_empty(o, ignore_spaces)
|
function types.is_empty(o, ignore_spaces)
|
||||||
if o == nil or (type(o) == "table" and not next(o)) or (type(o) == "string" and (o == "" or (ignore_spaces and o:match("^%s+$")))) then
|
if o == nil or (type(o) == "table" and not next(o)) or (type(o) == "string" and (o == "" or (ignore_spaces and o:match("^%s+$")))) then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
local function check_meta (val)
|
local function check_meta (val)
|
||||||
if type(val) == 'table' then return true end
|
if type(val) == 'table' then return true end
|
||||||
return getmetatable(val)
|
return getmetatable(val)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- is an object 'array-like'?
|
--- is an object 'array-like'?
|
||||||
-- @param val any value.
|
-- @param val any value.
|
||||||
function types.is_indexable (val)
|
function types.is_indexable (val)
|
||||||
local mt = check_meta(val)
|
local mt = check_meta(val)
|
||||||
if mt == true then return true end
|
if mt == true then return true end
|
||||||
return not(mt and mt.__len and mt.__index)
|
return not(mt and mt.__len and mt.__index)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- can an object be iterated over with `ipairs`?
|
--- can an object be iterated over with `ipairs`?
|
||||||
-- @param val any value.
|
-- @param val any value.
|
||||||
function types.is_iterable (val)
|
function types.is_iterable (val)
|
||||||
local mt = check_meta(val)
|
local mt = check_meta(val)
|
||||||
if mt == true then return true end
|
if mt == true then return true end
|
||||||
return not(mt and mt.__pairs)
|
return not(mt and mt.__pairs)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- can an object accept new key/pair values?
|
--- can an object accept new key/pair values?
|
||||||
-- @param val any value.
|
-- @param val any value.
|
||||||
function types.is_writeable (val)
|
function types.is_writeable (val)
|
||||||
local mt = check_meta(val)
|
local mt = check_meta(val)
|
||||||
if mt == true then return true end
|
if mt == true then return true end
|
||||||
return not(mt and mt.__newindex)
|
return not(mt and mt.__newindex)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Strings that should evaluate to true.
|
-- Strings that should evaluate to true.
|
||||||
local trues = { yes=true, y=true, ["true"]=true, t=true, ["1"]=true }
|
local trues = { yes=true, y=true, ["true"]=true, t=true, ["1"]=true }
|
||||||
-- Conditions types should evaluate to true.
|
-- Conditions types should evaluate to true.
|
||||||
local true_types = {
|
local true_types = {
|
||||||
boolean=function(o, true_strs, check_objs) return o end,
|
boolean=function(o, true_strs, check_objs) return o end,
|
||||||
string=function(o, true_strs, check_objs)
|
string=function(o, true_strs, check_objs)
|
||||||
if trues[o:lower()] then
|
if trues[o:lower()] then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
-- Check alternative user provided strings.
|
-- Check alternative user provided strings.
|
||||||
for _,v in ipairs(true_strs or {}) do
|
for _,v in ipairs(true_strs or {}) do
|
||||||
if type(v) == "string" and o == v:lower() then
|
if type(v) == "string" and o == v:lower() then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end,
|
end,
|
||||||
number=function(o, true_strs, check_objs) return o ~= 0 end,
|
number=function(o, true_strs, check_objs) return o ~= 0 end,
|
||||||
table=function(o, true_strs, check_objs) if check_objs and next(o) ~= nil then return true end return false end
|
table=function(o, true_strs, check_objs) if check_objs and next(o) ~= nil then return true end return false end
|
||||||
}
|
}
|
||||||
--- Convert to a boolean value.
|
--- Convert to a boolean value.
|
||||||
-- True values are:
|
-- True values are:
|
||||||
--
|
--
|
||||||
-- * boolean: true.
|
-- * boolean: true.
|
||||||
-- * string: 'yes', 'y', 'true', 't', '1' or additional strings specified by `true_strs`.
|
-- * string: 'yes', 'y', 'true', 't', '1' or additional strings specified by `true_strs`.
|
||||||
-- * number: Any non-zero value.
|
-- * number: Any non-zero value.
|
||||||
-- * table: Is not empty and `check_objs` is true.
|
-- * table: Is not empty and `check_objs` is true.
|
||||||
-- * object: Is not `nil` and `check_objs` is true.
|
-- * object: Is not `nil` and `check_objs` is true.
|
||||||
--
|
--
|
||||||
-- @param o The object to evaluate.
|
-- @param o The object to evaluate.
|
||||||
-- @param[opt] true_strs optional Additional strings that when matched should evaluate to true. Comparison is case insensitive.
|
-- @param[opt] true_strs optional Additional strings that when matched should evaluate to true. Comparison is case insensitive.
|
||||||
-- This should be a List of strings. E.g. "ja" to support German.
|
-- This should be a List of strings. E.g. "ja" to support German.
|
||||||
-- @param[opt] check_objs True if objects should be evaluated. Default is to evaluate objects as true if not nil
|
-- @param[opt] check_objs True if objects should be evaluated. Default is to evaluate objects as true if not nil
|
||||||
-- or if it is a table and it is not empty.
|
-- or if it is a table and it is not empty.
|
||||||
-- @return true if the input evaluates to true, otherwise false.
|
-- @return true if the input evaluates to true, otherwise false.
|
||||||
function types.to_bool(o, true_strs, check_objs)
|
function types.to_bool(o, true_strs, check_objs)
|
||||||
local true_func
|
local true_func
|
||||||
if true_strs then
|
if true_strs then
|
||||||
utils.assert_arg(2, true_strs, "table")
|
utils.assert_arg(2, true_strs, "table")
|
||||||
end
|
end
|
||||||
true_func = true_types[type(o)]
|
true_func = true_types[type(o)]
|
||||||
if true_func then
|
if true_func then
|
||||||
return true_func(o, true_strs, check_objs)
|
return true_func(o, true_strs, check_objs)
|
||||||
elseif check_objs and o ~= nil then
|
elseif check_objs and o ~= nil then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
return types
|
return types
|
||||||
|
@ -11,7 +11,7 @@ local unpack = rawget(_G,'unpack') or rawget(table,'unpack')
|
|||||||
local collisions = {}
|
local collisions = {}
|
||||||
|
|
||||||
local utils = {
|
local utils = {
|
||||||
_VERSION = "1.3.2",
|
_VERSION = "1.2.1",
|
||||||
lua51 = compat.lua51,
|
lua51 = compat.lua51,
|
||||||
setfenv = compat.setfenv,
|
setfenv = compat.setfenv,
|
||||||
getfenv = compat.getfenv,
|
getfenv = compat.getfenv,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user