Skip to content

Commit

Permalink
Update to 0.15.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ZwerOxotnik committed Oct 31, 2023
1 parent 7fd376b commit 921e232
Show file tree
Hide file tree
Showing 9 changed files with 214 additions and 37 deletions.
111 changes: 89 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,47 +72,114 @@

**3rd party libraries**:
- [basexx](/lualib/basexx.lua) - library for base2, base16, base32, base64, base85 decoding and encoding of data strings. ([source](https://github.com/aiq/basexx))\
`local basexx = require("__zk-lib__/lualib/basexx")`
```lua
local basexx = require(require("__zk-lib__/defines").modules.basexx)
```
- [bitwise](/lualib/bitwise.lua) - Bitwise operations. ([source](https://github.com/davidm/lua-bit-numberlua/blob/master/lmod/bit/numberlua.lua))\
`local bitwise = require("__zk-lib__/lualib/bitwise")`
```lua
local bitwise = require(require("__zk-lib__/defines").modules.bitwise)
```
- [fun](/lualib/fun.lua) - a functional programming library ([documentation](https://luafun.github.io/), [source](https://github.com/luafun/luafun/blob/master/fun.lua))\
`local fun = require("__zk-lib__/lualib/fun")` or `require "__zk-lib__/lualib/fun" ()`
```lua
local fun = require(require("__zk-lib__/defines").modules.fun)
--- or
local fun = require(require("__zk-lib__/defines").modules.fun)()
```
- [candran](/lualib/candran/candran.lua) - a Lua dialect and simple preprocessor ([source](https://github.com/Reuh/candran/tree/1e118381f8276fe66a2cad02f1b9f4535e7e253e)) (**WARNING:** this modified version has some bugs and some functions were removed due to technical limitations, please report in this repository if you have any issues with it)\
`local candran = require("__zk-lib__/lualib/candran/candran")`
```lua
local candran = require(require("__zk-lib__/defines").modules.candran)
```
- [LuLPeg](/lualib/LuLPeg) - A port of LPeg 100% written in Lua. ([source](https://github.com/pygy/LuLPeg/tree/f07f5be09d0461b1e83a8f811ca2c9cb79a69ab2)) (use with cautious)\
`local lpeg = require("__zk-lib__/lualib/LuLPeg/lulpeg")`
```lua
local lpeg = require(require("__zk-lib__/defines").modules.lulpeg)
```
- [Luxtre](/lualib/luxtre/) is a fully portable dialect of Lua 5.2 which compiles back into native code, written entirely in native Lua. It adds helpful additions and changes to Lua's default syntax and enables useful macros and preprocessing. ([documentation](https://github.com/DimitriBarronmore/luxtre/tree/a2854ef166b71b0e74252a55b0ec245cbc45f947/docs), [source](https://github.com/DimitriBarronmore/luxtre/tree/a2854ef166b71b0e74252a55b0ec245cbc45f947)) (not fully tested, can't be used outside of control.lua parsing yet)\
`local luxtre = require("__zk-lib__/lualib/luxtre/init")`
```lua
local luxtre = require(require("__zk-lib__/defines").modules.luxtre)
```
- [lal](/lualib/lal/) is the implementation of a Compiler for a Scheme like dialect of Lisp that compiles to Lua. ([documentation](/lualib/lal/doc/), [source](https://github.com/WeirdConstructor/lal/tree/38aaa0c426a9b52cd8d74d375f9a11e117be2007)) (expect bugs (I should fix some of them), can't be used outside of control.lua parsing yet)\
`# FAIL LAL-Compiler (74 OF 82 OK, 82 of 82 were run)`\
`local lal = require("__zk-lib__/lualib/lal/lal")`
```lua
local lal = require(require("__zk-lib__/defines").modules.lal)
```
- [tl](/lualib/tl/) is compiler for Teal, a typed dialect of Lua. ([tutorial](https://github.com/teal-language/tl/tree/a10fb2c69827c1b0f8e1b8a5c848a06d6da5d3be/docs/tutorial.md), [source](https://github.com/teal-language/tl/tree/a10fb2c69827c1b0f8e1b8a5c848a06d6da5d3be)) (not fully tested)\
`local tl = require("__zk-lib__/lualib/tl/0.15.1/tl")`
```lua
local tl = require(require("__zk-lib__/defines").modules.tl)
```
- [moonscript](/lualib/moonscript/) is a programmer friendly language that compiles into Lua. ([source](https://github.com/leafo/moonscript/tree/b7efcd131046ed921ae1075d7c0f6a3b64a570f7)) (not fully tested)\
`local moonscript = require("__zk-lib__/lualib/moonscript/base")`
```lua
local moonscript = require(require("__zk-lib__/defines").modules.moonscript)
```
- [std](/lualib/std/) is collection of Lua libraries. ([source](https://github.com/lua-stdlib/lua-stdlib/tree/a632078f216ac6b9994449b7f1435a419172b44f)) (not fully tested, some stuff were removed)
```lua
local std_modules = require("__zk-lib__/defines").modules.std
local init = require(std_modules.init)
local _base = require(std_modules._base)
local package = require(std_modules.package)
local debug = require(std_modules.debug)
local string = require(std_modules.string)
local table = require(std_modules.string)
local math = require(std_modules.math)
```
- [vivid](/lualib/vivid.lua) is simple color manipulation library. Used for color conversion and math. ([source](https://github.com/WetDesertRock/vivid/blob/55cb54578949f74534ab89e75e72a3f013292fda/vivid.lua), [documentation](https://github.com/WetDesertRock/vivid/tree/55cb54578949f74534ab89e75e72a3f013292fda))\
`local vivid = require("__zk-lib__/lualib/vivid")`
```lua
local vivid = require(require("__zk-lib__/defines").modules.vivid)
```
- [Penlight](/lualib/Penlight) brings together a set of generally useful pure Lua modules. ([source](https://github.com/lunarmodules/Penlight/tree/dc6d19c5c1e1b4ac55b14df17b7645af6b410140)) (not tested, some stuff were removed)
```lua
compat = require("lualib/Penlight/lua/pl/compat")
compat = require("__zk-lib__/lualib/Penlight/lua/pl/compat")
warn "@on"
```
`local tablex = require("__zk-lib__/lualib/Penlight/lua/pl/tablex")`\
`local array2d = require("__zk-lib__/lualib/Penlight/lua/pl/array2d")`\
`local Map = require("__zk-lib__/lualib/Penlight/lua/pl/Map")`\
`local List = require("__zk-lib__/lualib/Penlight/lua/pl/List")`\
`local Set = require("__zk-lib__/lualib/Penlight/lua/pl/Set")`\
`local MultiMap = require("__zk-lib__/lualib/Penlight/lua/pl/MultiMap")`\
`local OrderedMap = require("__zk-lib__/lualib/Penlight/lua/pl/OrderedMap")`\
etc.
```lua
local PL_modules = require("__zk-lib__/defines").modules.penlight
require(PL_modules.init) -- Entry point for loading all PL libraries only on demand, into the global space
local import_into = require(PL_modules.import_into)
local compat = require(PL_modules.compat)
local luabalanced = require(PL_modules.luabalanced)
local OrderedMap = require(PL_modules.OrderedMap)
local MultiMap = require(PL_modules.MultiMap)
local template = require(PL_modules.template)
local operator = require(PL_modules.operator)
local stringio = require(PL_modules.stringio)
local array2d = require(PL_modules.array2d)
local stringx = require(PL_modules.stringx)
local permute = require(PL_modules.permute)
local tablex = require(PL_modules.tablex)
local config = require(PL_modules.config)
local strict = require(PL_modules.strict)
local pretty = require(PL_modules.pretty)
local input = require(PL_modules.input)
local class = require(PL_modules.class)
local lexer = require(PL_modules.lexer)
local types = require(PL_modules.types)
local utils = require(PL_modules.utils)
local lapp = require(PL_modules.lapp)
local func = require(PL_modules.func)
local data = require(PL_modules.data)
local List = require(PL_modules.List)
local test = require(PL_modules.test)
local seq = require(PL_modules.seq)
local sip = require(PL_modules.sip)
local app = require(PL_modules.app)
local Map = require(PL_modules.Map)
local Set = require(PL_modules.Set)
local url = require(PL_modules.url)
local xml = require(PL_modules.xml)
local comprehension = require(PL_modules.comprehension)
```
- [Allen](/lualib/allen.lua) is a Lua library which provides a set of utilities and helpers for strings operations.\
Allen can be considered as an extension of the built-in Lua string library. ([source](https://github.com/Yonaba/Allen/tree/9abdcd0330d7007d77d67a97b0c4627a46a7f278), [documentation](https://yonaba.github.com/Allen))\
`local allen = require("__zk-lib__/lualib/allen")`
```lua
local allen = require(require("__zk-lib__/defines").modules.allen)
```
- [Guard](/lualib/guard.lua) Minimalistic library providing [Elixir](https://elixir-lang.org/crash-course.html)-style guards for Lua. ([source](https://github.com/Yonaba/guard.lua/tree/cc38583241195209f2af7c92cd97eb42a82f6514), [documentation](https://github.com/Yonaba/guard.lua/wiki))\
`local guard = require("__zk-lib__/lualib/guard")`
```lua
local guard = require(require("__zk-lib__/defines").modules.guard)
```
- Lua Class System ([LCS](/lualib/LCS.lua)) is a small library which offers a clean, minimalistic but powerful API for (Pseudo) Object Oriented programming style using Lua. ([source](https://github.com/Yonaba/Lua-Class-System/tree/7c8b7c816eee282770bdf206e253d38d348bc732))\
`local LCS = require("__zk-lib__/lualib/LCS")`
```lua
local LCS = require(require("__zk-lib__/defines").modules.LCS)
```

If you're interested in switchable commands with filters and in basic examples for Factorio, check out https://github.com/ZwerOxotnik/factorio-example-mod

Expand Down
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
---------------------------------------------------------------------------------------------------
Version: 0.15.3
Date: 31. 10. 2023
Scripting:
- Updated /static-libs
- Improved handling of modules for the mod
---------------------------------------------------------------------------------------------------
Version: 0.15.2
Date: 31. 10. 2023
Scripting:
Expand Down
20 changes: 10 additions & 10 deletions data.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
IS_DATA_STAGE=true
lazyAPI = require("experimental/lazyAPI")
local lazyAPI = lazyAPI
simpleTiers = require("experimental/simpleTiers")
easyTemplates = require("experimental/easyTemplates")
puan_api = require("data-api/puan_api")
puan2_api = require("data-api/puan2_api")
fakes = require("data-api/fakes")
zk_lib = require("data-api/zk_lib")
zk_SPD = require("experimental/SPD")
ZKLIB_DEFINES = require("defines")
lazyAPI = require(ZKLIB_DEFINES.modules.lazyAPI)
simpleTiers = require(ZKLIB_DEFINES.modules.simpleTiers)
easyTemplates = require(ZKLIB_DEFINES.modules.easyTemplates)
puan_api = require(ZKLIB_DEFINES.modules.puan_api)
puan2_api = require(ZKLIB_DEFINES.modules.puan2_api)
fakes = require(ZKLIB_DEFINES.modules.fakes)
zk_lib = require(ZKLIB_DEFINES.modules.zk_lib)
zk_SPD = require(ZKLIB_DEFINES.modules.SPD)
zk_SPD.create_container("important-no-cheat-recipes")
require("sound/sounds_list")


compat = require("__zk-lib__/lualib/Penlight/lua/pl/compat")
compat = require(ZKLIB_DEFINES.modules.penlight.compat)
warn "@on"


Expand Down
103 changes: 103 additions & 0 deletions defines.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
local defines = {
modules = {
easyTemplates = "__zk-lib__/experimental/easyTemplates",
gui_helper = "__zk-lib__/experimental/gui-helper",
simpleTiers = "__zk-lib__/experimental/simpleTiers",
ZKSettings = "__zk-lib__/experimental/ZKSettings",
lazyAPI = "__zk-lib__/experimental/lazyAPI",
SPD = "__zk-lib__/experimental/SPD",
fakes = "__zk-lib__/data-api/fakes",
puan_api = "__zk-lib__/data-api/puan_api", -- use puan2_api instead
puan2_api = "__zk-lib__/data-api/puan2_api",
zk_lib = "__zk-lib__/data-api/zk_lib", -- use easyAPi etc. instead
event_listener = "__zk-lib__/event-listener/branch-1/stable-version", -- use https://github.com/ZwerOxotnik/zk-factorio-static-lib/blob/master/lualibs/event_handler_vZO.lua instead
moonscript = "__zk-lib__/lualib/moonscript/base",
candran = "__zk-lib__/lualib/candran/candran",
bitwise = "__zk-lib__/lualib/bitwise",
luxtre = "__zk-lib__/lualib/luxtre/init",
basexx = "__zk-lib__/lualib/basexx",
allen = "__zk-lib__/lualib/allen",
vivid = "__zk-lib__/lualib/vivid",
guard = "__zk-lib__/lualib/guard",
lpeg = "__zk-lib__/lualib/LuLPeg/lulpeg",
LCS = "__zk-lib__/lualib/LCS",
lal = "__zk-lib__/lualib/lal",
fun = "__zk-lib__/lualib/fun",
tl = "__zk-lib__/lualib/tl/0.15.1/tl",
penlight = {
init = "__zk-lib__/lualib/Penlight/lua/pl/init",
import_into = "__zk-lib__/lualib/Penlight/lua/pl/import_into",
compat = "__zk-lib__/lualib/Penlight/lua/pl/compat",
luabalanced = "__zk-lib__/lualib/Penlight/lua/pl/luabalanced",
OrderedMap = "__zk-lib__/lualib/Penlight/lua/pl/OrderedMap",
MultiMap = "__zk-lib__/lualib/Penlight/lua/pl/MultiMap",
template = "__zk-lib__/lualib/Penlight/lua/pl/template",
operator = "__zk-lib__/lualib/Penlight/lua/pl/operator",
stringio = "__zk-lib__/lualib/Penlight/lua/pl/stringio",
array2d = "__zk-lib__/lualib/Penlight/lua/pl/array2d",
stringx = "__zk-lib__/lualib/Penlight/lua/pl/stringx",
permute = "__zk-lib__/lualib/Penlight/lua/pl/permute",
tablex = "__zk-lib__/lualib/Penlight/lua/pl/tablex",
pretty = "__zk-lib__/lualib/Penlight/lua/pl/pretty",
config = "__zk-lib__/lualib/Penlight/lua/pl/config",
strict = "__zk-lib__/lualib/Penlight/lua/pl/strict",
input = "__zk-lib__/lualib/Penlight/lua/pl/input",
class = "__zk-lib__/lualib/Penlight/lua/pl/class",
lexer = "__zk-lib__/lualib/Penlight/lua/pl/lexer",
types = "__zk-lib__/lualib/Penlight/lua/pl/types",
utils = "__zk-lib__/lualib/Penlight/lua/pl/utils",
lapp = "__zk-lib__/lualib/Penlight/lua/pl/lapp",
func = "__zk-lib__/lualib/Penlight/lua/pl/func",
data = "__zk-lib__/lualib/Penlight/lua/pl/data",
List = "__zk-lib__/lualib/Penlight/lua/pl/List",
test = "__zk-lib__/lualib/Penlight/lua/pl/test",
seq = "__zk-lib__/lualib/Penlight/lua/pl/seq",
sip = "__zk-lib__/lualib/Penlight/lua/pl/sip",
app = "__zk-lib__/lualib/Penlight/lua/pl/app",
Map = "__zk-lib__/lualib/Penlight/lua/pl/Map",
Set = "__zk-lib__/lualib/Penlight/lua/pl/Set",
url = "__zk-lib__/lualib/Penlight/lua/pl/url",
xml = "__zk-lib__/lualib/Penlight/lua/pl/xml",
comprehension = "__zk-lib__/lualib/Penlight/lua/pl/comprehension",
},
std = {
init = "__zk-lib__/lualib/std/init",
_base = "__zk-lib__/lualib/std/_base",
package = "__zk-lib__/lualib/std/package",
debug = "__zk-lib__/lualib/std/debug",
string = "__zk-lib__/lualib/std/string",
table = "__zk-lib__/lualib/std/table",
math = "__zk-lib__/lualib/std/math",
},
},
static_libs = {
event_handler_vZO = "__zk-lib__/static-libs/lualibs/event_handler_vZO",
all_control_utils = "__zk-lib__/static-libs/all_control_utils",
all_data_utils = "__zk-lib__/static-libs/all_data_utils",
coordinates_util = "__zk-lib__/static-libs/lualibs/coordinates-util",
rich_text_util = "__zk-lib__/static-libs/lualibs/rich-text-util",
number_util = "__zk-lib__/static-libs/lualibs/number-util",
time_util = "__zk-lib__/static-libs/lualibs/time-util",
version = "__zk-lib__/static-libs/lualibs/version",
lauxlib = "__zk-lib__/static-libs/lualibs/lauxlib",
locale = "__zk-lib__/static-libs/lualibs/locale",
control_stage = {
remote_interface_util = "__zk-lib__/static-libs/lualibs/control_stage/remote-interface-util",
GuiTemplater = "__zk-lib__/static-libs/lualibs/control_stage/GuiTemplater",
random_items = "__zk-lib__/static-libs/lualibs/control_stage/random_items",
inventory_util = "__zk-lib__/static-libs/lualibs/control_stage/inventory-util",
prototype_util = "__zk-lib__/static-libs/lualibs/control_stage/prototype-util",
surface_util = "__zk-lib__/static-libs/lualibs/control_stage/surface-util",
entity_util = "__zk-lib__/static-libs/lualibs/control_stage/entity-util",
market_util = "__zk-lib__/static-libs/lualibs/control_stage/market-util",
player_util = "__zk-lib__/static-libs/lualibs/control_stage/player-util",
biter_util = "__zk-lib__/static-libs/lualibs/control_stage/biter-util",
force_util = "__zk-lib__/static-libs/lualibs/control_stage/force-util",
rcon_util = "__zk-lib__/static-libs/lualibs/control_stage/rcon-util",
defines = "__zk-lib__/static-libs/lualibs/control_stage/defines",
}
}
}


return defines
1 change: 1 addition & 0 deletions experimental/gui-helper.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

--- Use https://github.com/ZwerOxotnik/zk-factorio-static-lib/blob/master/lualibs/control_stage/GuiTemplater.lua instead
local module = {}


Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zk-lib",
"version": "0.15.2",
"version": "0.15.3",
"factorio_version": "1.1",
"title": "ZwerOxotnik's extendable mod with 8 addons",
"author": "ZwerOxotnik",
Expand Down
1 change: 0 additions & 1 deletion lualib/Penlight/lua/pl/data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ local _DEBUG = rawget(_G,'_DEBUG')
local patterns,function_arg,usplit,array_tostring = utils.patterns,utils.function_arg,utils.split,utils.array_tostring
local append,concat = table.insert,table.concat
local gsub = string.gsub
local io = io
local _G,print,type,tonumber,ipairs,setmetatable = _G,print,type,tonumber,ipairs,setmetatable


Expand Down
5 changes: 3 additions & 2 deletions settings.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
IS_SETTING_STAGE = true
lazyAPI = require("experimental/lazyAPI")
ZKLIB_DEFINES = require("defines")
lazyAPI = require(ZKLIB_DEFINES.modules.lazyAPI)
local addons_api = require("addons/core/addons_api")
ZKSettings = require("__zk-lib__/experimental/ZKSettings")
ZKSettings = require(ZKLIB_DEFINES.modules.ZKSettings)
local ZKSettings = ZKSettings

ZKSettings.create_bool_setting("zk-lib-warn-about-addons")
Expand Down
2 changes: 1 addition & 1 deletion static-libs

0 comments on commit 921e232

Please sign in to comment.