Compare commits

...

2 Commits

@ -1,3 +1,3 @@
{
serialize = 'https://git.doublefourteen.io/lua/df-serialize'
serialize = 'https://gitea.it/1414codeforge/df-serialize'
}

@ -13,11 +13,11 @@ It makes your game easy to translate to multiple languages.
## Dependencies
**moonspeak** uses [df-serialize](https://git.doublefourteen.io/lua/df-serialize)
**moonspeak** uses [df-serialize](https://gitea.it/1414codeforge/df-serialize)
to read the dictionary file.
You may either doenload **df-serialize** manually and place it inside a `lib` subdirectory,
or use [crush](https://git.doublefourteen.io/lua/crush)
or use [crush](https://gitea.it/1414codeforge/crush)
to do this for you.
## Using crush to download moonspeak dependencies
@ -25,7 +25,7 @@ to do this for you.
1. Clone this repository.
```sh
git clone https://git.doublefourteen.io/lua/moonspeak
git clone https://gitea.it/1414codeforge/moonspeak
```
2. Move to repository root directory:
@ -44,14 +44,14 @@ You should now see a `lib` subdirectory containing the necessary dependencies.
## Integrating moonspeak in my project using crush
1. Download the latest [crush.lua](https://git.doublefourteen.io/lua/crush/src/branch/master/crush.lua) file and
1. Download the latest [crush.lua](https://gitea.it/1414codeforge/crush/src/branch/master/crush.lua) file and
place it in your project's root directory.
2. Create a `.lovedeps` text file in your project's root with the following dependency entry:
```lua
{
moonspeak = "https://git.doublefourteen.io/lua/moonspeak",
moonspeak = "https://gitea.it/1414codeforge/moonspeak",
-- ...more dependencies, if necessary...
}

@ -2,11 +2,39 @@
--
-- Author: Lorenzo Cogotti
-- Copyright: 2022 The DoubleFourteen Code Forge
-- License: MIT (see LICENSE file for details)
-- Home: https://gitea.it/1414codeforge/crush
-- License: MIT
local io = require 'io'
local os = require 'os'
-- Lua version check
local function check_version()
-- Generic Lua version check - 5.2 required
if _VERSION then
local maj, min = _VERSION:match("Lua (%d+)%.(%d+)")
if maj and min then
maj, min = tonumber(maj), tonumber(min)
if maj > 5 or (maj == 5 and min >= 2) then
return true
end
end
end
-- LuaJIT check - 2.0.0 required (technically 2.0.0_beta11)
if jit and jit.version_num and jit.version_num >= 20000 then
return true
end
return false
end
if not check_version() then
error("Unsupported Lua version!\nSorry, crush requires Lua 5.2 or LuaJIT 2.0.0.")
end
-- System specific functions
--
-- Portions of this code are based on work from the LuaRocks project.
@ -24,10 +52,6 @@ local chdir
local mkdir
if is_windows then
-- ---------------
-- NOTE: untested!
-- ---------------
-- local
function is_directory(path)
local fh, _, code = io.open(path, 'r')
@ -178,7 +202,11 @@ local function fetch(dep)
fullcmd = chdir("lib", quiet(cmd))
end
if not os.execute(fullcmd) then
-- On success, os.execute() returns:
-- true on regular Lua
-- 0 on LuaJIT (actual OS error code)
local code = os.execute(fullcmd)
if code ~= true and code ~= 0 then
error(dep.name..": Dependency fetch failed ("..cmd..").")
end
end

Loading…
Cancel
Save