Skip to content

Commit

Permalink
added Luacheck and corresponding workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonaasan committed Sep 27, 2024
1 parent 02be0c7 commit 5a58167
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 109 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/validate-lua.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Validate Lua Files

on:
push:
branches: [main]

jobs:
validate-lua:

container:
image: woahbase/alpine-lua:5.2.4

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: apk add --update gcc alpine-sdk

- name: Install luacheck
run: luarocks install luacheck

- name: Run luacheck
run: luacheck ./Prisma/
4 changes: 4 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
std = {
globals = {"init", "update", "uninit", "sb", "string", "localAnimator", "_ENV"},
read_globals = {"type", "pairs", "require"}
}
25 changes: 13 additions & 12 deletions Prisma/prisma/core/companion.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
local _init = init or function() end
local _update = update or function() end
local _uninit = uninit or function() end
local _init = init or function()
end;
local _update = update or function()
end;
local _uninit = uninit or function()
end;

string.prisma = string.prisma or {}
string.prisma = string.prisma or {};

function init(...)
return _init(...)
end

return _init(...);
end;
function update(...)
return _update(...)
end

return _update(...);
end;
function uninit(...)
return _uninit(...)
end
return _uninit(...);
end;
27 changes: 14 additions & 13 deletions Prisma/prisma/core/deployment.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
local _init = init or function() end
local _update = update or function() end
local _uninit = uninit or function() end
local _init = init or function()
end;
local _update = update or function()
end;
local _uninit = uninit or function()
end;

string.prisma = string.prisma or {}
string.prisma = string.prisma or {};

function init(...)
string.prisma.localAnimator = localAnimator
return _init(...)
end

string.prisma.localAnimator = localAnimator;
return _init(...);
end;
function update(...)
return _update(...)
end

return _update(...);
end;
function uninit(...)
return _uninit(...)
end
return _uninit(...);
end;
48 changes: 24 additions & 24 deletions Prisma/prisma/core/generic.lua
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
require("/prisma/debug/log.lua")
require("/prisma/debug/log.lua");

local _init = init or function() end
local _update = update or function() end
local _uninit = uninit or function() end
local _init = init or function()
end;
local _update = update or function()
end;
local _uninit = uninit or function()
end;

local firstSuccessUpdate = true -- boolean
local firstSuccessUpdate = true;


string.prisma = string.prisma or {}
string.prisma.debug = string.prisma.debug or {}
--if _SBLOADED["/prisma/debug/log.lua"] then
string.prisma.debug.enabled = false
--end
string.prisma = string.prisma or {};
string.prisma.debug = string.prisma.debug or {};
string.prisma.debug.enabled = false;

function init(...)
return _init(...)
end
return _init(...);
end;

function update(...)
if not localAnimator then
localAnimator = string.prisma.localAnimator
elseif firstSuccessUpdate then
sb.logInfo("Got the LocalAnimator!")
firstSuccessUpdate = false
string.prisma.debug.log.DetailedTableTree(_ENV, "")
end
return _update(...)
end
if not localAnimator then
localAnimator = string.prisma.localAnimator;
elseif firstSuccessUpdate then
sb.logInfo("Got the LocalAnimator!");
firstSuccessUpdate = false;
string.prisma.debug.log.DetailedTableTree(_ENV, "");
end;
return _update(...);
end;

function uninit(...)
return _uninit(...)
end
return _uninit(...);
end;
23 changes: 13 additions & 10 deletions Prisma/prisma/core/primary.lua
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
local _init = init or function() end
local _update = update or function() end
local _uninit = uninit or function() end
local _init = init or function()
end;
local _update = update or function()
end;
local _uninit = uninit or function()
end;

string.prisma = string.prisma or {}
string.prisma = string.prisma or {};

function init(...)
return _init(...)
end
return _init(...);
end;

function update(...)
return _update(...)
end
return _update(...);
end;

function uninit(...)
return _uninit(...)
end
return _uninit(...);
end;
100 changes: 50 additions & 50 deletions Prisma/prisma/debug/log.lua
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
string.prisma = string.prisma or {};
string.prisma.debug = string.prisma.debug or {};
string.prisma.debug.log = {};

string.prisma = string.prisma or {}
string.prisma.debug = string.prisma.debug or {}
string.prisma.debug.log = {}
function string.prisma.debug.log.tableList(node, displayString)
if not string.prisma.debug.enabled then
return;
end;
if type(node) == "table" then
for nodeName, nodeType in pairs(node) do
sb.logInfo("%s%s : %s", displayString, nodeName, type(nodeType));
string.prisma.debug.log.tableList(nodeType, displayString .. nodeName .. ".");
end;
end;
end;

function string.prisma.debug.log.TableList(e, p)
if not string.prisma.debug.enabled then
return
end
if type(e) == "table" then
for k, v in pairs(e) do
sb.logInfo("%s%s : %s",p,k, type(v))
--sb.logInfo("%s",v)
string.prisma.debug.log.TableList(v,p .. k .. ".")
end
end
end
function string.prisma.debug.log.tableTree(node, displayString)
if not string.prisma.debug.enabled then
return;
end;
if type(node) == "table" then
for nodeName, nodeType in pairs(node) do
local arrow = "";
if displayString ~= "" then
arrow = "└>";
end;
sb.logInfo("%s%s %s : %s", displayString, arrow, nodeName, type(nodeType));
string.prisma.debug.log.tableTree(nodeType, displayString .. " ");
end;
end;
end;

function string.prisma.debug.log.TableTree(e, p)
if not string.prisma.debug.enabled then
return
end
if type(e) == "table" then
for k, v in pairs(e) do
local arrow = ""
if p ~= "" then
arrow = "└>"
end
sb.logInfo("%s%s %s : %s",p,arrow,k, type(v))
--sb.logInfo("%s",v)
string.prisma.debug.log.TableTree(v,p .. " ")
end
end
end

function string.prisma.debug.log.DetailedTableTree(e, p)
if not string.prisma.debug.enabled then
return
end
if type(e) == "table" then
for k, v in pairs(e) do
local arrow = ""
if p ~= "" then
arrow = "└>"
end
sb.logInfo("%s%s %s : %s",p,arrow,k, type(v))
if type(v) ~= "table" and type(v) ~= "function" then
sb.logInfo("%s %s",p,v)
end
string.prisma.debug.log.DetailedTableTree(v,p .. " ")
end
end
end
function string.prisma.debug.log.detailedTableTree(node, displayString)
if not string.prisma.debug.enabled then
return;
end;
if type(node) == "table" then
for nodeName, nodeType in pairs(node) do
local arrow = "";
if displayString ~= "" then
arrow = "└>";
end;
sb.logInfo("%s%s %s : %s", displayString, arrow, nodeName, type(nodeType));
if type(nodeType) ~= "table" and type(nodeType) ~= "function" then
sb.logInfo("%s %s", displayString, nodeType);
end;
string.prisma.debug.log.detailedTableTree(nodeType, displayString .. " ");
end;
end;
end;

function string.prisma.debug.log.info()
sb.logInfo();
end;

0 comments on commit 5a58167

Please sign in to comment.