replace compile.bat with instructions in readme, remove third-party lualibs, add string type, fix luacall args
This commit is contained in:
@@ -106,14 +106,14 @@ local function valToTs(val)
|
||||
error('valToTs: could not convert '..type(val), 3)
|
||||
end
|
||||
end
|
||||
local fromTsForceTypes = {
|
||||
['boolean'] = tsBool,
|
||||
['object'] = function(val) toTsObject(val) end, -- toTsObject not defined yet
|
||||
['string'] = tostring,
|
||||
}
|
||||
local function convertValFromTs(val, typ)
|
||||
if typ=='boolean' then
|
||||
return tsBool(val)
|
||||
elseif typ=='object' then
|
||||
return toTsObject(val)
|
||||
else
|
||||
return fromTsForceTypes[typ](val) or
|
||||
error('valFromTs: invalid force type '..typ, 4)
|
||||
end
|
||||
end
|
||||
bl._forceType = bl._forceType or {}
|
||||
local function valFromTs(val, name, name2) -- todo: ensure name and name2 are already lowercase
|
||||
@@ -167,8 +167,8 @@ local function classFromForceTypeStr(name)
|
||||
end
|
||||
local setForceType
|
||||
setForceType = function(ftname, typ)
|
||||
if typ~='boolean' and typ~='object' and typ~=nil then
|
||||
error('bl.type: can only set type to \'boolean\', \'object\', or nil', 2) end
|
||||
if typ~=nil and not fromTsForceTypes[typ] then
|
||||
error('bl.type: invalid type \''..typ..'\'', 2) end
|
||||
if not isValidFuncNameNsArgn(ftname) then
|
||||
error('bl.type: invalid function or variable name \''..ftname..'\'', 2) end
|
||||
|
||||
@@ -557,11 +557,11 @@ function bl.array(name, ...)
|
||||
return name..table.concat(rest, '_')
|
||||
end
|
||||
function _bllua_call(fnameS, ...)
|
||||
local args = arglistFromTs(fnameS:lower(), {...})
|
||||
local args = arglistFromTs('lua:'..fnameS:lower(), {...})
|
||||
if not _G[fnameS] then
|
||||
error('luacall: no global lua function named \''..fnameS..'\'') end
|
||||
-- todo: library fields and object methods
|
||||
local res = _G[fnameS](args)
|
||||
local res = _G[fnameS](unpack(args))
|
||||
return valToTs(res)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user