formatting
This commit is contained in:
@@ -83,16 +83,16 @@ local toTsObject
|
|||||||
local function tsBool(v) return v ~= '' and v ~= '0' end
|
local function tsBool(v) return v ~= '' and v ~= '0' end
|
||||||
-- Convert a Lua var into a TS string, or error if not possible
|
-- Convert a Lua var into a TS string, or error if not possible
|
||||||
local function valToTs(val)
|
local function valToTs(val)
|
||||||
if val == nil then -- nil -> ''
|
if val == nil then -- nil -> ''
|
||||||
return ''
|
return ''
|
||||||
elseif type(val) == 'boolean' then -- bool -> 0 or 1
|
elseif type(val) == 'boolean' then -- bool -> 0 or 1
|
||||||
return val and '1' or '0'
|
return val and '1' or '0'
|
||||||
elseif type(val) == 'number' then -- number
|
elseif type(val) == 'number' then -- number
|
||||||
return tostring(val)
|
return tostring(val)
|
||||||
elseif type(val) == 'string' then -- string
|
elseif type(val) == 'string' then -- string
|
||||||
return val
|
return val
|
||||||
elseif type(val) == 'table' then
|
elseif type(val) == 'table' then
|
||||||
if val._tsObjectId then -- object -> object id
|
if val._tsObjectId then -- object -> object id
|
||||||
return tostring(val._tsObjectId)
|
return tostring(val._tsObjectId)
|
||||||
elseif isTsVector(val) then -- vector - > 3 numbers
|
elseif isTsVector(val) then -- vector - > 3 numbers
|
||||||
return table.concat(val, ' ')
|
return table.concat(val, ' ')
|
||||||
@@ -1023,9 +1023,9 @@ local function parseTsDecl(decl)
|
|||||||
if decl:find(' ') then -- class ...
|
if decl:find(' ') then -- class ...
|
||||||
local cl, rest = decl:match('^([^ ]+) ([^ ]+)$')
|
local cl, rest = decl:match('^([^ ]+) ([^ ]+)$')
|
||||||
class = cl
|
class = cl
|
||||||
if rest:find(':') then -- class name:inherit
|
if rest:find(':') then -- class name:inherit
|
||||||
name, inherit = rest:match('^([^:]*):([^:]+)$')
|
name, inherit = rest:match('^([^:]*):([^:]+)$')
|
||||||
if not name then class = nil end -- error
|
if not name then class = nil end -- error
|
||||||
if name == '' then name = nil end -- class :inherit
|
if name == '' then name = nil end -- class :inherit
|
||||||
else
|
else
|
||||||
name = rest
|
name = rest
|
||||||
|
|||||||
@@ -183,14 +183,14 @@ function require(mod)
|
|||||||
if require_memo[mod] then return unpack(require_memo[mod]) end
|
if require_memo[mod] then return unpack(require_memo[mod]) end
|
||||||
local fp = mod:gsub('%.', '/')
|
local fp = mod:gsub('%.', '/')
|
||||||
local fns = {
|
local fns = {
|
||||||
'./' .. fp .. '.lua', -- local file
|
'./' .. fp .. '.lua', -- local file
|
||||||
'./' .. fp .. '/init.lua', -- local library
|
'./' .. fp .. '/init.lua', -- local library
|
||||||
fp .. '.lua', -- global file
|
fp .. '.lua', -- global file
|
||||||
fp .. '/init.lua', -- global library
|
fp .. '/init.lua', -- global library
|
||||||
}
|
}
|
||||||
if fp:lower():find('^add-ons/') then
|
if fp:lower():find('^add-ons/') then
|
||||||
local addonpath = fp:lower():match('^add-ons/[^/]+') .. '/'
|
local addonpath = fp:lower():match('^add-ons/[^/]+') .. '/'
|
||||||
table.insert(fns, addonpath .. fp .. '.lua') -- add-on file
|
table.insert(fns, addonpath .. fp .. '.lua') -- add-on file
|
||||||
table.insert(fns, addonpath .. fp .. '/init.lua') -- add-on library
|
table.insert(fns, addonpath .. fp .. '/init.lua') -- add-on library
|
||||||
end
|
end
|
||||||
for _, fn in ipairs(fns) do
|
for _, fn in ipairs(fns) do
|
||||||
|
|||||||
Reference in New Issue
Block a user