Skip to content

Commit 64d489a

Browse files
committed
Rename toolbelt to missing
1 parent 6f94d14 commit 64d489a

File tree

10 files changed

+49
-54
lines changed

10 files changed

+49
-54
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
luacov.*.out
2-
package_toolbelt.lua
3-
toolbelt.p8
2+
package_missing.lua
3+
missing.p8

.luacov

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ return {
3636
-- all will be included if nothing is listed
3737
-- (exclude overrules include, do not include
3838
-- the .lua extension, path separator is always '/')
39-
["include"] = { 'package_toolbelt' },
39+
["include"] = { 'package_missing' },
4040

4141
-- Patterns for files to exclude when reporting
4242
-- all will be included if nothing is listed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ deploy:
2525
api_key:
2626
secure: RyAo2tKLINNUOWCxW+0s5JvyIMM3KIJqDBNDWJtrJcrJCzdNNeZQsEAM7pDq8HXUogPgYbambclbQeQK7tEvqZ1KvQ5rlWaL67A6LaAX+npEcFP38HTlnkFAX57es3lcAlA96+0WJgqrpD7tv2Us2v6f7mTQmrtzha+zLcc5vM5bc6dZu/lRryZuJi+Ih+meANnIesqx3KKvz4j4y4oR+dwPi45eIVEVOoj4Cz6jyIhfYD0KlbnoZ/avWoZPZSyeUJFx0CuuVCkKzpYagjM/nuumhLwJM6aO2UNOI0XVocMgzqx7rlmORETw4VJYDwJYwi/UlDsShXg0dMdecMfXLKsQpjjymDenSDN9EenbQnlVpre9s6/jklb8m+bW5IE6rw/IGx8NT8HC+UhTVlxr/XOdAdYf/TGoyBSOeLXWNs2rYrnLwM/AJtbOyhE7ixnrbpTRJp4VAk9CbYLLVGe4JjqmR372VxXpwtemiuaXNtNbcOZMoMtJpDlFKZQj9KBc49BgO21m3m0fYHkN4sQf3V65o08j9zVqUYxCZ+kLGRzaaAE+JtAoCn8bBROyaqh4sw7Xpj21g1ZOiyAlGRxhwR2STPMODBFovF+71tqNsdEIQA+w89GP+1DzMqVfZ/VGEoqgH3WcjC3O5Yy9pyvgf+SMpDz4e8UFDTdW02QHfdY=
2727
file:
28-
- toolbelt.p8
29-
- toolbelt.lua
28+
- missing.p8
29+
- missing.lua
3030
skip_cleanup: true
3131
on:
3232
tags: true

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# pico8-missing-builtins
22
[![travis-ci](https://travis-ci.org/adamscott/pico8-missing-builtins.svg?branch=master)](https://travis-ci.org/adamscott/pico8-missing-builtins)
3-
[![codecov](https://codecov.io/gh/adamscott/pico8-missing-toolbelt/branch/master/graph/badge.svg)](https://codecov.io/gh/adamscott/pico8-missing-toolbelt)
3+
[![codecov](https://codecov.io/gh/adamscott/pico8-missing-builtins/branch/master/graph/badge.svg)](https://codecov.io/gh/adamscott/pico8-missing-builtins)
44

55
You miss built-in lua functions such as `ipairs` or `getmetatable` in [pico-8](http://www.lexaloffle.com/pico-8.php)? Well, fear no more.
66

@@ -12,12 +12,12 @@ You miss built-in lua functions such as `ipairs` or `getmetatable` in [pico-8](h
1212
- `ipairs`
1313

1414
### Tested to imitate their counterparts
15-
Travis-CI is set to test `toolbelt.lua` against `test.lua`, which compares results of this library functions with the built-in ones. Well, tests may be incomplete, so do not hesitate to [flag a bug to the issue tracker](https://github.com/adamscott/pico8-missing-builtins/issues) if something goes wrong.
15+
Travis-CI is set to test `missing.lua` against `test.lua`, which compares results of this library functions with the built-in ones. Well, tests may be incomplete, so do not hesitate to [flag a bug to the issue tracker](https://github.com/adamscott/pico8-missing-builtins/issues) if something goes wrong.
1616

1717
## How to use
1818
Heads up to the [lastest release.](https://github.com/adamscott/pico8-missing-builtins/releases/latest) Then, there's two options:
19-
* Either you download `toolbelt.lua` then copy the file contents into your `.p8` project file, preferably before the rest of your code; or
20-
* you load `toolbelt.p8` in pico-8 to test it out first.
19+
* Either you download `missing.lua` then copy the file contents into your `.p8` project file, preferably before the rest of your code; or
20+
* you load `missing.p8` in pico-8 to test it out first.
2121

2222
### About this license
2323
This library is under creative commons license [CC4-BY-NC-SA](https://creativecommons.org/licenses/by-nc-sa/4.0/). See [LICENSE.md](LICENSE.md). It's the same license as the optional one on Lexaloffle's website if you choose to publish a cart.

generate_package.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import shutil
44
import re
55

6-
with open('package_toolbelt.lua', 'w') as w:
6+
with open('package_missing.lua', 'w') as w:
77
matches = []
8-
with open('toolbelt.lua', 'r') as r:
8+
with open('missing.lua', 'r') as r:
99
for line in r:
1010
match = re.match(r'function (\w+) \(', line)
1111
if match is not None:

generate_pico8.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
import shutil
44
import re
55

6-
with open('toolbelt.p8', 'w') as f:
6+
with open('missing.p8', 'w') as f:
77
lua_content = None
8-
toolbelt_content = None
9-
with open('toolbelt.lua', 'r') as r:
8+
missing_content = None
9+
with open('missing.lua', 'r') as r:
1010
lua_content = r.read()
1111
r.close()
12-
with open('template_toolbelt.p8', 'r') as r:
13-
toolbelt_content = r.read()
12+
with open('template_missing.p8', 'r') as r:
13+
missing_content = r.read()
1414
r.close()
15-
toolbelt_content = re.sub(r'\#insert_toolbelt\#', lua_content, toolbelt_content)
16-
f.write(toolbelt_content)
15+
missing_content = re.sub(r'\#insert_missing\#', lua_content, missing_content)
16+
f.write(missing_content)
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
-- pico8-missing-builtins v0.1.3
2+
-- https://github.com/adamscott/pico8-missing-builtins
13
__setmetatable = setmetatable
24
__metatables = {}
35
function setmetatable (object, mt)
46
__metatables[object] = mt
57
return __setmetatable(object, mt)
68
end
7-
89
function getmetatable (object)
910
return __metatables[object]
1011
end
@@ -15,15 +16,11 @@ function rawget (tbl, index)
1516
local ti = tbl.__index
1617
local mt = getmetatable(tbl)
1718
local value = nil
18-
1919
tbl.__index = tbl
2020
__setmetatable(tbl, nil)
21-
2221
value = tbl[index]
23-
2422
tbl.__index = ti
2523
__setmetatable(tbl, mt)
26-
2724
return value
2825
end
2926

@@ -32,12 +29,10 @@ function unpack (arr, i, j)
3229
local k = 0
3330
local initial_i = i
3431
j = j or #arr
35-
3632
for i = i or 1, j do
3733
k = k + 1
3834
n[k] = arr[i]
3935
end
40-
4136
local l = k
4237
local function create_arg(l, ...)
4338
if l == 0 then
@@ -46,7 +41,6 @@ function unpack (arr, i, j)
4641
return create_arg(l - 1, n[l], ...)
4742
end
4843
end
49-
5044
return create_arg(l)
5145
end
5246

@@ -57,3 +51,4 @@ function ipairs (arr)
5751
if i <= n then return i, arr[i] end
5852
end
5953
end
54+
-- END pico8-missing-builtins v0.1.3
File renamed without changes.

template_toolbelt.p8 renamed to template_missing.p8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pico-8 cartridge // http://www.pico-8.com
22
version 7
33
__lua__
44

5-
#insert_toolbelt#
5+
#insert_missing#
66

77
-- ============================
88
-- ============================

test.lua

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
toolbelt = require('package_toolbelt')
1+
missing = require('package_missing')
22

3-
describe("toolbelt -setmetatable-", function()
3+
describe("missing -setmetatable-", function()
44
it("should set a metatable", function()
5-
local Test_toolbelt = {}
6-
Test_toolbelt.__index = Test_toolbelt
7-
function Test_toolbelt:_init (name)
5+
local Test_missing = {}
6+
Test_missing.__index = Test_missing
7+
function Test_missing:_init (name)
88
self.name = name
99
end
1010
local Test_native = {}
11-
Test_native.__index = Test_toolbelt
11+
Test_native.__index = Test_missing
1212
function Test_native:_init (name)
1313
self.name = name
1414
end
@@ -21,17 +21,17 @@ describe("toolbelt -setmetatable-", function()
2121
}
2222

2323
setmetatable(Test_native, mt)
24-
toolbelt.setmetatable(Test_toolbelt, mt)
24+
missing.setmetatable(Test_missing, mt)
2525
assert.are.equals(
2626
getmetatable(Test_native),
27-
getmetatable(Test_toolbelt)
27+
getmetatable(Test_missing)
2828
)
2929
assert.truthy(Test_native("native"))
30-
assert.truthy(Test_toolbelt("toolbelt"))
30+
assert.truthy(Test_missing("missing"))
3131
end)
3232
end)
3333

34-
describe("toolbelt -getmetatable-", function()
34+
describe("missing -getmetatable-", function()
3535
it("should get a metatable", function()
3636
local Test = {}
3737
Test.__index = Test
@@ -41,15 +41,15 @@ describe("toolbelt -getmetatable-", function()
4141
return self
4242
end
4343
}
44-
toolbelt.setmetatable(Test, mt)
44+
missing.setmetatable(Test, mt)
4545
assert.are.equals(
4646
getmetatable(Test),
47-
toolbelt.getmetatable(Test)
47+
missing.getmetatable(Test)
4848
)
4949
end)
5050
end)
5151

52-
describe("toolbelt -rawget-", function()
52+
describe("missing -rawget-", function()
5353
it("should get raw value", function ()
5454
local setValue = 125
5555
local Test = {
@@ -61,7 +61,7 @@ describe("toolbelt -rawget-", function()
6161
return defaultValue
6262
end
6363
}
64-
toolbelt.setmetatable(Test, mt)
64+
missing.setmetatable(Test, mt)
6565
assert.are.equals(
6666
Test.doNotExist,
6767
defaultValue
@@ -72,21 +72,21 @@ describe("toolbelt -rawget-", function()
7272
)
7373
assert.are.equals(
7474
rawget(Test, 'doNotExist'),
75-
toolbelt.rawget(Test, 'doNotExist')
75+
missing.rawget(Test, 'doNotExist')
7676
)
7777
assert.are.equals(
78-
toolbelt.rawget(Test, 'value'),
78+
missing.rawget(Test, 'value'),
7979
setValue
8080
)
8181
end)
8282
end)
8383

84-
describe("toolbelt -unpack-", function()
84+
describe("missing -unpack-", function()
8585
it("should unpack table", function()
8686
local unpack_table = {1,2,3,4,5}
8787
local unpack_i = 0
8888
local unpack_j = 0
89-
local a, b, c, d, e, f, g, h = toolbelt.unpack(unpack_table)
89+
local a, b, c, d, e, f, g, h = missing.unpack(unpack_table)
9090
local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table)
9191
assert.are.equals(a, _a)
9292
assert.are.equals(b, _b)
@@ -102,7 +102,7 @@ describe("toolbelt -unpack-", function()
102102
local unpack_table = {1,2,3,4,5}
103103
local unpack_i = 3
104104
local unpack_j = 0
105-
local a, b, c, d, e, f, g, h = toolbelt.unpack(unpack_table, unpack_i)
105+
local a, b, c, d, e, f, g, h = missing.unpack(unpack_table, unpack_i)
106106
local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table, unpack_i)
107107
assert.are.equals(a, _a)
108108
assert.are.equals(b, _b)
@@ -118,7 +118,7 @@ describe("toolbelt -unpack-", function()
118118
local unpack_table = {1,2,3,4,5}
119119
local unpack_i = -2
120120
local unpack_j = 0
121-
local a, b, c, d, e, f, g, h = toolbelt.unpack(unpack_table, unpack_i)
121+
local a, b, c, d, e, f, g, h = missing.unpack(unpack_table, unpack_i)
122122
local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table, unpack_i)
123123
assert.are.equals(a, _a)
124124
assert.are.equals(b, _b)
@@ -134,7 +134,7 @@ describe("toolbelt -unpack-", function()
134134
local unpack_table = {1,2,3,4,5}
135135
local unpack_i = 8
136136
local unpack_j = 0
137-
local a, b, c, d, e, f, g, h = toolbelt.unpack(unpack_table, unpack_i)
137+
local a, b, c, d, e, f, g, h = missing.unpack(unpack_table, unpack_i)
138138
local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table, unpack_i)
139139
assert.are.equals(a, _a)
140140
assert.are.equals(b, _b)
@@ -150,7 +150,7 @@ describe("toolbelt -unpack-", function()
150150
local unpack_table = {1,2,3,4,5}
151151
local unpack_i = 3
152152
local unpack_j = 5
153-
local a, b, c, d, e, f, g, h = toolbelt.unpack(unpack_table, unpack_i, unpack_j)
153+
local a, b, c, d, e, f, g, h = missing.unpack(unpack_table, unpack_i, unpack_j)
154154
local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table, unpack_i, unpack_j)
155155
assert.are.equals(a, _a)
156156
assert.are.equals(b, _b)
@@ -166,7 +166,7 @@ describe("toolbelt -unpack-", function()
166166
local unpack_table = {1,2,3,4,5}
167167
local unpack_i = -1
168168
local unpack_j = 3
169-
local a, b, c, d, e, f, g, h = toolbelt.unpack(unpack_table, unpack_i, unpack_j)
169+
local a, b, c, d, e, f, g, h = missing.unpack(unpack_table, unpack_i, unpack_j)
170170
local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table, unpack_i, unpack_j)
171171
assert.are.equals(a, _a)
172172
assert.are.equals(b, _b)
@@ -182,7 +182,7 @@ describe("toolbelt -unpack-", function()
182182
local unpack_table = {1,2,3,4,5}
183183
local unpack_i = 10
184184
local unpack_j = 4
185-
local a, b, c, d, e, f, g, h = toolbelt.unpack(unpack_table, unpack_i, unpack_j)
185+
local a, b, c, d, e, f, g, h = missing.unpack(unpack_table, unpack_i, unpack_j)
186186
local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table, unpack_i, unpack_j)
187187
assert.are.equals(a, _a)
188188
assert.are.equals(b, _b)
@@ -198,7 +198,7 @@ describe("toolbelt -unpack-", function()
198198
local unpack_table = {1,2,3,4,5}
199199
local unpack_i = -1
200200
local unpack_j = -6
201-
local a, b, c, d, e, f, g, h = toolbelt.unpack(unpack_table, unpack_i, unpack_j)
201+
local a, b, c, d, e, f, g, h = missing.unpack(unpack_table, unpack_i, unpack_j)
202202
local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table, unpack_i, unpack_j)
203203
assert.are.equals(a, _a)
204204
assert.are.equals(b, _b)
@@ -211,13 +211,13 @@ describe("toolbelt -unpack-", function()
211211
end)
212212
end)
213213

214-
describe("toolbelt -ipairs-", function()
214+
describe("missing -ipairs-", function()
215215
it("should iterate a table with i,v as for values", function()
216216
local test_table = {2,4,8,16,32,64,128,256,512,1024}
217217
for i,v in ipairs(test_table) do
218218
assert.are.equals(2^i, v)
219219
end
220-
for i,v in toolbelt.ipairs(test_table) do
220+
for i,v in missing.ipairs(test_table) do
221221
assert.are.equals(2^i, v)
222222
end
223223
end)

0 commit comments

Comments
 (0)