├── .gitignore ├── .luacov ├── .travis.yml ├── .travis ├── platform.sh ├── setenv_lua.sh └── setup_lua.sh ├── LICENSE.md ├── README.md ├── generate_package.py ├── generate_pico8.py ├── missing.lua ├── template_missing.p8 └── test.lua /.gitignore: -------------------------------------------------------------------------------- 1 | luacov.*.out 2 | package_missing.lua 3 | missing.p8 4 | -------------------------------------------------------------------------------- /.luacov: -------------------------------------------------------------------------------- 1 | --- Global configuration file. Copy, customize and store in your 2 | -- project folder as '.luacov' for project specific configuration. 3 | -- If some options are missing, their default values from this file 4 | -- will be used. 5 | -- @class module 6 | -- @name luacov.defaults 7 | return { 8 | 9 | -- default filename to load for config options if not provided 10 | -- only has effect in 'luacov.defaults.lua' 11 | ["configfile"] = ".luacov", 12 | 13 | -- filename to store stats collected 14 | ["statsfile"] = "luacov.stats.out", 15 | 16 | -- filename to store report 17 | ["reportfile"] = "luacov.report.out", 18 | 19 | -- luacov.stats file updating frequency. 20 | -- The lower this value - the more frequenty results will be written out to luacov.stats 21 | -- You may want to reduce this value for short lived scripts (to for example 2) to avoid losing coverage data. 22 | ["savestepsize"] = 100, 23 | 24 | -- Run reporter on completion? (won't work for ticks) 25 | runreport = true, 26 | 27 | -- Delete stats file after reporting? 28 | deletestats = false, 29 | 30 | -- Process Lua code loaded from raw strings 31 | -- (that is, when the 'source' field in the debug info 32 | -- does not start with '@') 33 | codefromstrings = false, 34 | 35 | -- Patterns for files to include when reporting 36 | -- all will be included if nothing is listed 37 | -- (exclude overrules include, do not include 38 | -- the .lua extension, path separator is always '/') 39 | ["include"] = { 'package_missing' }, 40 | 41 | -- Patterns for files to exclude when reporting 42 | -- all will be included if nothing is listed 43 | -- (exclude overrules include, do not include 44 | -- the .lua extension, path separator is always '/') 45 | ["exclude"] = { 46 | "luacov$", 47 | "luacov/reporter$", 48 | "luacov/defaults$", 49 | "luacov/runner$", 50 | "luacov/stats$", 51 | "luacov/tick$", 52 | }, 53 | 54 | 55 | } 56 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | sudo: false 3 | env: 4 | global: 5 | - LUAROCKS=2.2.2 6 | matrix: 7 | - LUA=lua5.1 8 | addons: 9 | apt: 10 | packages: 11 | - python3 12 | before_install: 13 | - source .travis/setenv_lua.sh 14 | - luarocks install luacov 15 | - luarocks install busted 16 | script: 17 | - python generate_package.py 18 | - busted -c test.lua -o TAP 19 | after_success: 20 | - bash <(curl -s https://codecov.io/bash) 21 | before_deploy: 22 | - python generate_pico8.py 23 | deploy: 24 | provider: releases 25 | api_key: 26 | 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= 27 | file: 28 | - missing.p8 29 | - missing.lua 30 | skip_cleanup: true 31 | on: 32 | tags: true 33 | -------------------------------------------------------------------------------- /.travis/platform.sh: -------------------------------------------------------------------------------- 1 | if [ -z "${PLATFORM:-}" ]; then 2 | PLATFORM=$TRAVIS_OS_NAME; 3 | fi 4 | 5 | if [ "$PLATFORM" == "osx" ]; then 6 | PLATFORM="macosx"; 7 | fi 8 | 9 | if [ -z "$PLATFORM" ]; then 10 | if [ "$(uname)" == "Linux" ]; then 11 | PLATFORM="linux"; 12 | else 13 | PLATFORM="macosx"; 14 | fi; 15 | fi 16 | -------------------------------------------------------------------------------- /.travis/setenv_lua.sh: -------------------------------------------------------------------------------- 1 | export PATH=${PATH}:$HOME/.lua:$HOME/.local/bin:${TRAVIS_BUILD_DIR}/install/luarocks/bin 2 | bash .travis/setup_lua.sh 3 | eval `$HOME/.lua/luarocks path` 4 | -------------------------------------------------------------------------------- /.travis/setup_lua.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | # A script for setting up environment for travis-ci testing. 4 | # Sets up Lua and Luarocks. 5 | # LUA must be "lua5.1", "lua5.2" or "luajit". 6 | # luajit2.0 - master v2.0 7 | # luajit2.1 - master v2.1 8 | 9 | set -eufo pipefail 10 | 11 | LUAJIT_BASE="LuaJIT-2.0.4" 12 | 13 | source .travis/platform.sh 14 | 15 | LUA_HOME_DIR=$TRAVIS_BUILD_DIR/install/lua 16 | 17 | LR_HOME_DIR=$TRAVIS_BUILD_DIR/install/luarocks 18 | 19 | mkdir $HOME/.lua 20 | 21 | LUAJIT="no" 22 | 23 | if [ "$PLATFORM" == "macosx" ]; then 24 | if [ "$LUA" == "luajit" ]; then 25 | LUAJIT="yes"; 26 | fi 27 | if [ "$LUA" == "luajit2.0" ]; then 28 | LUAJIT="yes"; 29 | fi 30 | if [ "$LUA" == "luajit2.1" ]; then 31 | LUAJIT="yes"; 32 | fi; 33 | elif [ "$(expr substr $LUA 1 6)" == "luajit" ]; then 34 | LUAJIT="yes"; 35 | fi 36 | 37 | mkdir -p "$LUA_HOME_DIR" 38 | 39 | if [ "$LUAJIT" == "yes" ]; then 40 | 41 | if [ "$LUA" == "luajit" ]; then 42 | curl http://luajit.org/download/$LUAJIT_BASE.tar.gz | tar xz; 43 | else 44 | git clone http://luajit.org/git/luajit-2.0.git $LUAJIT_BASE; 45 | fi 46 | 47 | cd $LUAJIT_BASE 48 | 49 | if [ "$LUA" == "luajit2.1" ]; then 50 | git checkout v2.1; 51 | fi 52 | 53 | make && make install PREFIX="$LUA_HOME_DIR" 54 | 55 | if [ "$LUA" == "luajit2.1" ]; then 56 | ln -s $LUA_HOME_DIR/bin/luajit-2.1.0-alpha $HOME/.lua/luajit 57 | ln -s $LUA_HOME_DIR/bin/luajit-2.1.0-alpha $HOME/.lua/lua; 58 | else 59 | ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/luajit 60 | ln -s $LUA_HOME_DIR/bin/luajit $HOME/.lua/lua; 61 | fi; 62 | 63 | else 64 | 65 | if [ "$LUA" == "lua5.1" ]; then 66 | curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz 67 | cd lua-5.1.5; 68 | elif [ "$LUA" == "lua5.2" ]; then 69 | curl http://www.lua.org/ftp/lua-5.2.4.tar.gz | tar xz 70 | cd lua-5.2.4; 71 | elif [ "$LUA" == "lua5.3" ]; then 72 | curl http://www.lua.org/ftp/lua-5.3.1.tar.gz | tar xz 73 | cd lua-5.3.1; 74 | fi 75 | 76 | # Build Lua without backwards compatibility for testing 77 | perl -i -pe 's/-DLUA_COMPAT_(ALL|5_2)//' src/Makefile 78 | make $PLATFORM 79 | make INSTALL_TOP="$LUA_HOME_DIR" install; 80 | 81 | ln -s $LUA_HOME_DIR/bin/lua $HOME/.lua/lua 82 | ln -s $LUA_HOME_DIR/bin/luac $HOME/.lua/luac; 83 | 84 | fi 85 | 86 | cd $TRAVIS_BUILD_DIR 87 | 88 | lua -v 89 | 90 | LUAROCKS_BASE=luarocks-$LUAROCKS 91 | 92 | curl --location http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz | tar xz 93 | 94 | cd $LUAROCKS_BASE 95 | 96 | if [ "$LUA" == "luajit" ]; then 97 | ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR"; 98 | elif [ "$LUA" == "luajit2.0" ]; then 99 | ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.0" --prefix="$LR_HOME_DIR"; 100 | elif [ "$LUA" == "luajit2.1" ]; then 101 | ./configure --lua-suffix=jit --with-lua-include="$LUA_HOME_DIR/include/luajit-2.1" --prefix="$LR_HOME_DIR"; 102 | else 103 | ./configure --with-lua="$LUA_HOME_DIR" --prefix="$LR_HOME_DIR" 104 | fi 105 | 106 | make build && make install 107 | 108 | ln -s $LR_HOME_DIR/bin/luarocks $HOME/.lua/luarocks 109 | 110 | cd $TRAVIS_BUILD_DIR 111 | 112 | luarocks --version 113 | 114 | rm -rf $LUAROCKS_BASE 115 | 116 | if [ "$LUAJIT" == "yes" ]; then 117 | rm -rf $LUAJIT_BASE; 118 | elif [ "$LUA" == "lua5.1" ]; then 119 | rm -rf lua-5.1.5; 120 | elif [ "$LUA" == "lua5.2" ]; then 121 | rm -rf lua-5.2.4; 122 | elif [ "$LUA" == "lua5.3" ]; then 123 | rm -rf lua-5.3.1; 124 | fi 125 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License 2 | 3 | By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions. 4 | 5 | ## Section 1 – Definitions. 6 | * **Adapted Material** means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image. 7 | * **Adapter's License** means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License. 8 | * **BY-NC-SA Compatible License** means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License. 9 | * **Copyright and Similar Rights** means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. 10 | * **Effective Technological Measures** means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements. 11 | * **Exceptions and Limitations** means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material. 12 | * **License Elements** means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike. 13 | * **Licensed Material** means the artistic or literary work, database, or other material to which the Licensor applied this Public License. 14 | * **Licensed Rights** means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license. 15 | * **Licensor** means the individual(s) or entity(ies) granting rights under this Public License. 16 | * **NonCommercial** means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange. 17 | * **Share** means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them. 18 | * **Sui Generis Database Rights** means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world. 19 | * **You** means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning. 20 | 21 | ## Section 2 – Scope. 22 | * **License grant.** 23 | * Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to: 24 | * reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and 25 | * produce, reproduce, and Share Adapted Material for NonCommercial purposes only. 26 | * *Exceptions and Limitations.* For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions. 27 | * *Term.* The term of this Public License is specified in Section 6(a). 28 | * *Media and formats; technical modifications allowed.* The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material. 29 | * *Downstream recipients.* 30 | * *Offer from the Licensor – Licensed Material.* Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License. 31 | * *Additional offer from the Licensor – Adapted Material.* Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply. 32 | * *No downstream restrictions.* You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material. 33 | * *No endorsement.* Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i). 34 | * **Other rights.** 35 | * Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise. 36 | * Patent and trademark rights are not licensed under this Public License. 37 | * To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes. 38 | 39 | ## Section 3 – License Conditions. 40 | Your exercise of the Licensed Rights is expressly made subject to the following conditions. 41 | 42 | * **Attribution.** 43 | * If You Share the Licensed Material (including in modified form), You must: 44 | * retain the following if it is supplied by the Licensor with the Licensed Material: 45 | * identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated); 46 | * a copyright notice; 47 | * a notice that refers to this Public License; 48 | * a notice that refers to the disclaimer of warranties; 49 | * a URI or hyperlink to the Licensed Material to the extent reasonably practicable; 50 | * indicate if You modified the Licensed Material and retain an indication of any previous modifications; and 51 | * indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License. 52 | * You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information. 53 | * If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable. 54 | * **ShareAlike.** 55 | In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply. 56 | * The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License. 57 | * You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material. 58 | * You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply. 59 | 60 | ## Section 4 – Sui Generis Database Rights. 61 | Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material: 62 | * for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only; 63 | * if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and 64 | * You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database. 65 | For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights. 66 | 67 | ## Section 5 – Disclaimer of Warranties and Limitation of Liability. 68 | * **Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.** 69 | * **To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.** 70 | * The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability. 71 | 72 | ## Section 6 – Term and Termination. 73 | * This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically. 74 | * Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates: 75 | * automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or 76 | * upon express reinstatement by the Licensor. 77 | For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License. 78 | * For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License. 79 | * Sections 1, 5, 6, 7, and 8 survive termination of this Public License. 80 | 81 | ## Section 7 – Other Terms and Conditions. 82 | * The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed. 83 | * Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License. 84 | 85 | ## Section 8 – Interpretation. 86 | 87 | * For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License. 88 | * To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions. 89 | * No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor. 90 | * Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority. 91 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # pico8-missing-builtins 2 | [![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-builtins/branch/master/graph/badge.svg)](https://codecov.io/gh/adamscott/pico8-missing-builtins) 4 | 5 | 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. 6 | 7 | ## Currently supported Lua "built-in" functions 8 | - `getmetatable` 9 | - `setmetatable` 10 | - `rawget` 11 | - `unpack` 12 | - `ipairs` 13 | - `table.pack` 14 | - `table.unpack` as an alias to `unpack` 15 | - `table.insert` 16 | - `table.remove` 17 | - `table.sort` 18 | 19 | ### Tested to imitate their counterparts 20 | 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. 21 | 22 | ## How to use 23 | Heads up to the [latest release.](https://github.com/adamscott/pico8-missing-builtins/releases/latest) Then, there's two options: 24 | * Either you download `missing.lua` then copy the file contents into your `.p8` project file, preferably before the rest of your code; or 25 | * you load `missing.p8` in pico-8 to test it out first. 26 | 27 | ### About this license 28 | 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. 29 | 30 | So, if you happen to publish a cart using this library, it would be nice if you mention it. 31 | 32 | ## Thanks 33 | To Lexaloffle, which this library would not exist without pico-8. 34 | 35 | ## Changes 36 | ### 0.2 37 | - Add some `table` functions. 38 | - `table.pack` 39 | - `table.unpack` as an alias to `unpack` 40 | - `table.insert` 41 | - `table.remove` 42 | - `table.sort` 43 | - Refactor `ipairs` to make it return an `iter` function, as the native one does. 44 | 45 | ### 0.1 46 | - Add 47 | - `getmetatable` 48 | - `setmetatable` 49 | - `rawget` 50 | - `unpack` 51 | - `ipairs` 52 | -------------------------------------------------------------------------------- /generate_package.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python 2 | 3 | import shutil 4 | import re 5 | 6 | with open('package_missing.lua', 'w') as w: 7 | matches = [] 8 | with open('missing.lua', 'r') as r: 9 | for line in r: 10 | function_match = re.match(r'function (\w+) \(', line) 11 | table_match = re.match(r'(table) = \{\}', line) 12 | if function_match is not None: 13 | line = re.sub(r'(function \w+ \()', r'local \1', line) 14 | matches.append(function_match.group(1)) 15 | elif table_match is not None: 16 | line = re.sub(r'(table = \{\})', r'local \1', line) 17 | matches.append(table_match.group(1)) 18 | w.write(line) 19 | r.close() 20 | w.write("\n") 21 | w.write('return { \n') 22 | for match in matches: 23 | w.write(' {} = {},\n'.format(match, match)) 24 | w.write("}\n") 25 | w.close() 26 | -------------------------------------------------------------------------------- /generate_pico8.py: -------------------------------------------------------------------------------- 1 | #!/bin/env python 2 | 3 | import shutil 4 | import re 5 | 6 | with open('missing.p8', 'w') as f: 7 | lua_content = None 8 | missing_content = None 9 | with open('missing.lua', 'r') as r: 10 | lua_content = "" 11 | for line in r: 12 | if re.match(r'^ {12}[\w.]+', line) is not None: 13 | line = re.sub(r'^ {12}([\w.]+)', r' \1', line) 14 | elif re.match(r'^ {10}[\w.]+', line) is not None: 15 | line = re.sub(r'^ {10}([\w.]+)', r' \1', line) 16 | elif re.match(r'^ {8}[\w.]+', line) is not None: 17 | line = re.sub(r'^ {8}([\w.]+)', r' \1', line) 18 | elif re.match(r'^ {6}[\w.]+', line) is not None: 19 | line = re.sub(r'^ {6}([\w.]+)', r' \1', line) 20 | elif re.match(r'^ {4}[\w.]+', line) is not None: 21 | line = re.sub(r'^ {4}([\w.]+)', r' \1', line) 22 | elif re.match(r'^ {2}[\w.]+', line) is not None: 23 | line = re.sub(r'^ {2}([\w.]+)', r' \1', line) 24 | lua_content += line 25 | r.close() 26 | with open('template_missing.p8', 'r') as r: 27 | missing_content = r.read() 28 | r.close() 29 | missing_content = re.sub(r'\#insert_missing\#', lua_content, missing_content) 30 | f.write(missing_content) 31 | -------------------------------------------------------------------------------- /missing.lua: -------------------------------------------------------------------------------- 1 | -- pico8-missing-builtins v0.2.0 2 | -- https://github.com/adamscott/pico8-missing-builtins 3 | __setmetatable = setmetatable 4 | __metatables = {} 5 | function setmetatable (object, mt) 6 | __metatables[object] = mt 7 | return __setmetatable(object, mt) 8 | end 9 | -- getmetatable depends on this setmetatable implementation 10 | function getmetatable (object) 11 | return __metatables[object] 12 | end 13 | 14 | -- rawget depends on getmetatable 15 | function rawget (tbl, index) 16 | assert(type(tbl) == 'table', "bad argument #1 to 'rawget' " 17 | .."(table expected, got "..type(tbl)..")") 18 | local ti = tbl.__index 19 | local mt = getmetatable(tbl) 20 | local value = nil 21 | tbl.__index = tbl 22 | __setmetatable(tbl, nil) 23 | value = tbl[index] 24 | tbl.__index = ti 25 | __setmetatable(tbl, mt) 26 | return value 27 | end 28 | 29 | function unpack (arr, i, j) 30 | local n = {} 31 | local k = 0 32 | local initial_i = i 33 | j = j or #arr 34 | for i = i or 1, j do 35 | k = k + 1 36 | n[k] = arr[i] 37 | end 38 | local l = k 39 | local function create_arg(l, ...) 40 | if l == 0 then 41 | return ... 42 | else 43 | return create_arg(l - 1, n[l], ...) 44 | end 45 | end 46 | return create_arg(l) 47 | end 48 | 49 | function ipairs (a) 50 | local function iter(a, i) 51 | i = i + 1 52 | local v = a[i] 53 | if v then 54 | return i, v 55 | end 56 | end 57 | return iter, a, 0 58 | end 59 | 60 | table = {} 61 | table.pack = function (...) return {...} end 62 | table.unpack = unpack 63 | 64 | function table.insert (list, pos, value) 65 | assert(type(list) == 'table', "bad argument #1 to 'insert' " 66 | .."(table expected, got "..type(list)..")") 67 | if pos and not value then 68 | value = pos 69 | pos = #list + 1 70 | else 71 | assert(type(pos) == 'number', "bad argument #2 to 'insert' " 72 | .."(number expected, got "..type(pos)..")") 73 | end 74 | if pos <= #list then 75 | for i = #list, pos, -1 do 76 | list[i + 1] = list[i] 77 | end 78 | end 79 | list[pos] = value 80 | end 81 | 82 | function table.remove(list, pos) 83 | assert(type(list) == 'table', "bad argument #1 to 'remove' " 84 | .."(table expected, got "..type(list)..")") 85 | if not pos then 86 | pos = #list 87 | else 88 | assert(type(pos) == 'number', "bad argument #2 to 'remove' " 89 | .."(number expected, got "..type(tbl)..")") 90 | end 91 | for i = pos, #list do 92 | list[i] = list[i + 1] 93 | end 94 | end 95 | 96 | function table.sort (arr, comp) 97 | if not comp then 98 | comp = function (a, b) 99 | return a < b 100 | end 101 | end 102 | local function partition (a, lo, hi) 103 | pivot = a[hi] 104 | i = lo - 1 105 | for j = lo, hi - 1 do 106 | if comp(a[j], pivot) then 107 | i = i + 1 108 | a[i], a[j] = a[j], a[i] 109 | end 110 | end 111 | a[i + 1], a[hi] = a[hi], a[i + 1] 112 | return i + 1 113 | end 114 | local function quicksort (a, lo, hi) 115 | if lo < hi then 116 | p = partition(a, lo, hi) 117 | quicksort(a, lo, p - 1) 118 | return quicksort(a, p + 1, hi) 119 | end 120 | end 121 | return quicksort(arr, 1, #arr) 122 | end 123 | -- END pico8-missing-builtins v0.1.3 124 | -------------------------------------------------------------------------------- /template_missing.p8: -------------------------------------------------------------------------------- 1 | pico-8 cartridge // http://www.pico-8.com 2 | version 7 3 | __lua__ 4 | 5 | #insert_missing# 6 | 7 | -- ============================ 8 | -- ============================ 9 | 10 | function _init() 11 | cls() 12 | map(0,0,0,0,16,16) 13 | test_getmetatable() 14 | test_setmetatable() 15 | test_rawget() 16 | test_unpack() 17 | test_ipairs() 18 | test_table_pack() 19 | test_table_insert() 20 | test_table_remove() 21 | test_table_sort() 22 | print("every test passed.") 23 | end 24 | 25 | -- ============================ 26 | -- ============================ 27 | 28 | function test_getmetatable() 29 | printh("==> 'getmetatable'") 30 | printh("----> with a metatable previously set") 31 | local test = {} 32 | test.__init = function (self, message) 33 | self.message = message 34 | end 35 | test.__index = test 36 | local mt = { 37 | __call = function (cls, ...) 38 | local self = setmetatable({}, cls) 39 | self.__index = self 40 | self:__init(...) 41 | return self 42 | end 43 | } 44 | setmetatable(test, mt) 45 | assert(getmetatable(test) == mt, 'fail') 46 | printh('pass') 47 | end 48 | 49 | function test_setmetatable() 50 | printh("==> 'setmetatable'") 51 | printh("----> with simple oop") 52 | local test = {} 53 | test.__init = function (self, message) 54 | self.message = message 55 | end 56 | test.__index = test 57 | local mt = { 58 | __call = function (cls, ...) 59 | local self = setmetatable({}, cls) 60 | self.__index = self 61 | self:__init(...) 62 | return self 63 | end 64 | } 65 | setmetatable(test, mt) 66 | local hello_world = 'hello, world.' 67 | local test_instance = test(hello_world) 68 | assert(test_instance.message == hello_world, "fail") 69 | printh("pass") 70 | end 71 | 72 | function test_rawget() 73 | printh("==> 'rawget'") 74 | printh("----> get value") 75 | local existing_value = 3 76 | local test = { 77 | a = existing_value 78 | } 79 | test.__index = test 80 | local default_value = "#default" 81 | local mt = { 82 | __index = function (tbl, key) 83 | return default_value 84 | end 85 | } 86 | setmetatable(test, mt) 87 | assert(test.a == existing_value, "fail") 88 | assert(test.do_not_exist == default_value, "fail") 89 | assert(rawget(test, 'do_not_exist') == nil, "fail") 90 | printh("pass") 91 | end 92 | 93 | function test_unpack() 94 | printh("==> 'unpack'") 95 | printh("----> unpack table") 96 | local a, b, c, d, e, f, g, h 97 | local unpack_table = {1,2,3,4,5} 98 | local unpack_i = 0 99 | local unpack_j = 0 100 | a, b, c, d, e, f, g, h = nil, nil, nil, nil, nil, nil, nil, nil 101 | a, b, c, d, e, f, g, h = unpack(unpack_table) 102 | assert(a == 1, "fail") 103 | assert(b == 2, "fail") 104 | assert(c == 3, "fail") 105 | assert(d == 4, "fail") 106 | assert(e == 5, "fail") 107 | assert(f == nil, "fail") 108 | assert(g == nil, "fail") 109 | assert(h == nil, "fail") 110 | 111 | printh("----> with i as arg") 112 | a, b, c, d, e, f, g, h = nil, nil, nil, nil, nil, nil, nil, nil 113 | unpack_i = 3 114 | unpack_j = 0 115 | a, b, c, d, e, f, g, h = unpack(unpack_table, unpack_i) 116 | assert(a == 3, "fail") 117 | assert(b == 4, "fail") 118 | assert(c == 5, "fail") 119 | assert(d == nil, "fail") 120 | assert(e == nil, "fail") 121 | assert(f == nil, "fail") 122 | assert(g == nil, "fail") 123 | assert(h == nil, "fail") 124 | 125 | printh("----> with -i as arg") 126 | a, b, c, d, e, f, g, h = nil, nil, nil, nil, nil, nil, nil, nil 127 | unpack_i = -2 128 | unpack_j = 0 129 | a, b, c, d, e, f, g, h = unpack(unpack_table, unpack_i) 130 | assert(a == nil, "fail") 131 | assert(b == nil, "fail") 132 | assert(c == nil, "fail") 133 | assert(d == 1, "fail") 134 | assert(e == 2, "fail") 135 | assert(f == 3, "fail") 136 | assert(g == 4, "fail") 137 | assert(h == 5, "fail") 138 | 139 | printh("----> with i > #unpack_table as arg") 140 | a, b, c, d, e, f, g, h = nil, nil, nil, nil, nil, nil, nil, nil 141 | unpack_i = 8 142 | unpack_j = 0 143 | a, b, c, d, e, f, g, h = unpack(unpack_table, unpack_i) 144 | assert(a == nil, "fail") 145 | assert(b == nil, "fail") 146 | assert(c == nil, "fail") 147 | assert(d == nil, "fail") 148 | assert(e == nil, "fail") 149 | assert(f == nil, "fail") 150 | assert(g == nil, "fail") 151 | assert(h == nil, "fail") 152 | 153 | printh("----> with i and j as arg") 154 | a, b, c, d, e, f, g, h = nil, nil, nil, nil, nil, nil, nil, nil 155 | unpack_i = 3 156 | unpack_j = 5 157 | a, b, c, d, e, f, g, h = unpack(unpack_table, unpack_i, unpack_j) 158 | assert(a == 3, "fail") 159 | assert(b == 4, "fail") 160 | assert(c == 5, "fail") 161 | assert(d == nil, "fail") 162 | assert(e == nil, "fail") 163 | assert(f == nil, "fail") 164 | assert(g == nil, "fail") 165 | assert(h == nil, "fail") 166 | 167 | printh("----> with -i and j as arg") 168 | a, b, c, d, e, f, g, h = nil, nil, nil, nil, nil, nil, nil, nil 169 | unpack_i = -1 170 | unpack_j = 3 171 | a, b, c, d, e, f, g, h = unpack(unpack_table, unpack_i, unpack_j) 172 | assert(a == nil, "fail") 173 | assert(b == nil, "fail") 174 | assert(c == 1, "fail") 175 | assert(d == 2, "fail") 176 | assert(e == 3, "fail") 177 | assert(f == nil, "fail") 178 | assert(g == nil, "fail") 179 | assert(h == nil, "fail") 180 | 181 | printh("----> with i > #unpack_table and j as arg") 182 | a, b, c, d, e, f, g, h = nil, nil, nil, nil, nil, nil, nil, nil 183 | unpack_i = 10 184 | unpack_j = 4 185 | a, b, c, d, e, f, g, h = unpack(unpack_table, unpack_i, unpack_j) 186 | assert(a == nil, "fail") 187 | assert(b == nil, "fail") 188 | assert(c == nil, "fail") 189 | assert(d == nil, "fail") 190 | assert(e == nil, "fail") 191 | assert(f == nil, "fail") 192 | assert(g == nil, "fail") 193 | assert(h == nil, "fail") 194 | 195 | printh("----> with -i and -j as arg") 196 | a, b, c, d, e, f, g, h = nil, nil, nil, nil, nil, nil, nil, nil 197 | unpack_i = -1 198 | unpack_j = -6 199 | a, b, c, d, e, f, g, h = unpack(unpack_table, unpack_i, unpack_j) 200 | assert(a == nil, "fail") 201 | assert(b == nil, "fail") 202 | assert(c == nil, "fail") 203 | assert(d == nil, "fail") 204 | assert(e == nil, "fail") 205 | assert(f == nil, "fail") 206 | assert(g == nil, "fail") 207 | assert(h == nil, "fail") 208 | printh("pass") 209 | end 210 | 211 | function test_ipairs() 212 | printh("==> 'ipairs'") 213 | printh("----> with i,v as for values") 214 | local test_table = {2,4,8,16,32,64,128,256,512,1024} 215 | for i,v in ipairs(test_table) do 216 | assert(2^i == v, "fail") 217 | end 218 | printh("----> return an iter function") 219 | test_table = {2,4,8,16,32,64,128,256,512,1024} 220 | iter, i, v = ipairs(test_table) 221 | assert(type(iter) == "function", "fail") 222 | printh("pass") 223 | end 224 | 225 | function test_table_pack() 226 | printh("==> 'table.pack'") 227 | printh("----> pack values") 228 | local values = table.pack(1,2,3,4,5) 229 | assert(values[1] == 1, "fail") 230 | assert(values[2] == 2, "fail") 231 | assert(values[3] == 3, "fail") 232 | assert(values[4] == 4, "fail") 233 | assert(values[5] == 5, "fail") 234 | printh("pass") 235 | end 236 | 237 | function test_table_insert() 238 | printh("==> 'table.insert'") 239 | printh("----> insert value") 240 | local test_table = {22,-20,67,1009,-500} 241 | table.insert(test_table, 10) 242 | assert(test_table[1] == 22, "fail") 243 | assert(test_table[2] == -20, "fail") 244 | assert(test_table[3] == 67, "fail") 245 | assert(test_table[4] == 1009, "fail") 246 | assert(test_table[5] == -500, "fail") 247 | assert(test_table[6] == 10, "fail") 248 | printh("----> insert value at specified pos") 249 | test_table = {-3,-2,-1,0,2,3} 250 | table.insert(test_table, 5, 1) 251 | assert(test_table[1] == -3, "fail") 252 | assert(test_table[2] == -2, "fail") 253 | assert(test_table[3] == -1, "fail") 254 | assert(test_table[4] == 0, "fail") 255 | assert(test_table[5] == 1, "fail") 256 | assert(test_table[6] == 2, "fail") 257 | assert(test_table[7] == 3, "fail") 258 | printh("pass") 259 | end 260 | 261 | function test_table_remove() 262 | printh("==> 'table.remove'") 263 | printh("----> remove value") 264 | local test_table = {-3,-2,-1,0,1,2,3} 265 | table.remove(test_table) 266 | assert(test_table[1] == -3, "fail") 267 | assert(test_table[2] == -2, "fail") 268 | assert(test_table[3] == -1, "fail") 269 | assert(test_table[4] == 0, "fail") 270 | assert(test_table[5] == 1, "fail") 271 | assert(test_table[6] == 2, "fail") 272 | assert(test_table[7] == nil, "fail") 273 | printh("----> remove value at specified pos") 274 | test_table = {-3,-2,-1,0,1,2,3} 275 | table.remove(test_table, 1) 276 | assert(test_table[1] == -2, "fail") 277 | assert(test_table[2] == -1, "fail") 278 | assert(test_table[3] == 0, "fail") 279 | assert(test_table[4] == 1, "fail") 280 | assert(test_table[5] == 2, "fail") 281 | assert(test_table[6] == 3, "fail") 282 | assert(test_table[7] == nil, "fail") 283 | printh("pass") 284 | end 285 | 286 | function test_table_sort() 287 | printh("==> 'table.sort'") 288 | printh("----> sort simple table") 289 | local test_table = {33,3,333,87,13,252,-29} 290 | table.sort(test_table) 291 | assert(test_table[1] == -29, "fail") 292 | assert(test_table[2] == 3, "fail") 293 | assert(test_table[3] == 13, "fail") 294 | assert(test_table[4] == 33, "fail") 295 | assert(test_table[5] == 87, "fail") 296 | assert(test_table[6] == 252, "fail") 297 | assert(test_table[7] == 333, "fail") 298 | printh("----> sort simple table with given comp function") 299 | local function desc(a,b) 300 | return a > b 301 | end 302 | test_table = {33,3,333,87,13,252,-29} 303 | table.sort(test_table, desc) 304 | assert(test_table[1] == 333, "fail") 305 | assert(test_table[2] == 252, "fail") 306 | assert(test_table[3] == 87, "fail") 307 | assert(test_table[4] == 33, "fail") 308 | assert(test_table[5] == 13, "fail") 309 | assert(test_table[6] == 3, "fail") 310 | assert(test_table[7] == -29, "fail") 311 | printh("pass") 312 | end 313 | 314 | __gfx__ 315 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 316 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000088888800000000000000 317 | 00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000888888880000000000000 318 | 00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000888228880000000000000 319 | 00077000000000000000000066666666660000000000000000000000000000000000000000000000000000000000000000000000000882008880000000000000 320 | 0070070000000000000066666666666666600000000006666d000000000000066666666666000000000000000000000000000000000888888820000000000000 321 | 0000000000000000000666666666666666666000000006666d110000000006666666666666600000000000000000000000000000000888888888800000000000 322 | 0000000000000000000666666666666666666600000006666d1100000000666666666666666d0000000000000000666666666000000088888888880000000000 323 | 0000000000000000000666666666dd66666666d1000006666d11000000066666666666666666d000000000000066666666666600000888882228882000000000 324 | 00000000000000000006666666dd11d6666666d1000066666d11000000666666666666666666d100000000000666666666666660000888220008882000000000 325 | 0000000000000000000666666d11111d666666d1000066666d1100000066666666ddd6666666d100000000006666666666666660000888200088882000000000 326 | 000000000000000000066666d1100000066666d1000066666d110000066666666d111dd66666d100000000066666666666666666000888800888820000000000 327 | 00000000000000000006666d11000000666666d1000066666d11000006666666d111111ddddd110000000066666666ddd6666666600088888888200000000000 328 | 00000000000000000066666d11000006666666d1000066666d1100006666666d11101111111110000000006666666d111d666666660002888822000000000000 329 | 00000000000000000066666d10000006666666d100006666d1100000666666d11110000001110000000006666666d1111166666666d000222200000000000000 330 | 00000000000000000066666d1000006666666d1100066666d1100000666666d1100000000000000000000666666d11000006666666d100000000000000000000 331 | 00000000000000000066666d1000066666666d1000066666d110000666666d1110000000000000000000666666d110000000666666d100000000000000000000 332 | 0000000000000000066666d1100066666666d1100006666d110000066666d1110000000000000000000066666d1100000000666666d100000000000000000000 333 | 0000000000000000066666d1166666666666d1000006666d110000066666d1100000000000000000000066666d1100000000066666d100000000000000000000 334 | 0000000000000000066666666666666666dd11000006666d110000066666d1100000000000000000000066666d1000000000066666d100000000000000000000 335 | 000000000000000006666666666666666d1110000006666d110000066666d110000000000000000000006666d11000000000666666d100000000000000000000 336 | 0000000000000000066666666666666dd11100000066666d100000066666d110000000000000000000006666d11000000000666666d100000000000000000000 337 | 00000000000000006666666666666dd111100000006666d1100000066666d1100000000000000000000066666d1000000006666666d100000000000000000000 338 | 0000000000000000666666ddddddd11110000000006666d11000000666666d100000000000006666d00066666d1000000006666666d100000000000000000000 339 | 000000000000000066666d111111110000000000006666d11000000666666d100000000000066666d000666666d000000066666666d100000000000000000000 340 | 000000000000000066666d100000000000000000006666d110000000666666dd0000000000066666d1006666666d00000666666666d100000000000000000000 341 | 00000000000000006666d1100000000000000000006666d110000000d66666666666666666666666d10006666666d000666666666d1100000000000000000000 342 | 00000000000000066666d1000000000000000000006666d110000000166666666666666666666666d100066666666666666666666d1100000000000000000000 343 | 00000000000000066666d1000000000000000000006666d1100000000d666666666666666666666d1100016666666666666666666d1100000000000000000000 344 | 0000000000000006666d11000000000000000000006666d10000000001dd6666666666666666666d110000166666666666666666dd1000000000000000000000 345 | 0000000000000066666d10000000000000000000006666d1000000000011d66666666666666666d111000011666666666666666d111000000000000000000000 346 | 0000000000000066666d10000000000000000000066666d10000000000011dddd6666666666ddd11100000011666666666666dd1110000000000000000000000 347 | 0000000000000066666d1000000000000000000006666d1100000000000011111dddddddddd1111100000000111dddddddddd111100000000000000000000000 348 | 0000000000000066666d100000000000000000000ddddd1100000000000000001111111111111110000000000011111111111111000000000000000000000000 349 | 00000000000000ddddd1100000000000000000000111111100000000000000000001111111111000000000000000111111111100000000000000000000000000 350 | 00000000000000111111000000000000000000000011111000000000000000000000000000000000000000000000000000000000000000000000000000000000 351 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 352 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 353 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 354 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 355 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 356 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 357 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 358 | 00000000000000000000000000000000000000000000000000000000000000035353535353535353535300000000000000000000000000000000000000000000 359 | 00000000000000000000000000000000000000000000000005353530003535353535353535353535353535353535353535353535353530000000000000000000 360 | 00000000000000000000535353535353535353535353535353535353035353535353535353535353535353535353535353535353535353500000000000000000 361 | 00000000000000053535353535353535353535353535353535353535053535353535353535353535353535353535353535353535353535353535000000000000 362 | 00000000000353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353000000000000 363 | 00000000053535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535000000000000 364 | 000000000353535353535353535353535353535353535353535353535353535353535353535353535bbb53535353535353535353535353535353000000000000 365 | 0000000005353535353535353535353535bbb4353535353bb43535353535353535353535353535b53bbb35353535353535353535353535353535000000000000 366 | 000000000353535353bbbbb453535353bbbbb4535353535bb4535353bbb353535354bbbb534bbbbbbb4454bb535354bbb3535354bbbb53535355000000000000 367 | 00000000053535353bbbbbbb45353535bbbbb435bb353bbbb43535bbbbbb353534bbbbbbb54bbbbbb43534bbb53534bbb535354bbbbbb5353535000000000000 368 | 00000000535353535bbbbbbbb4535353bbb45353bbbbbbbb43535bbbbbbbb35354bbb4bbb34bbbbb435354bbb353534bb353534bbb4bb3535353000000000000 369 | 000000003535353535353bbbb4353535bbb43535bbbbbbb43535bbbb444bbb454bbb454bbb3444bb353534bbb535354bbb3534bbb44bbb353535000000000000 370 | 000000005353535353535bbbbb435353bbbb435354444bb45353bbb45353bb434bbb534bbb5354bb535354bbbb53534bbb5354bbb34bbb535353000000000000 371 | 000000003535353535353bbbbb45353bbbbbb43535353bb4353bbb453535bb454bb534bbbb3534bb353534bbbb353534bb354bbb354bbb353535000000000000 372 | 000000005353535353535bbbbbb4535bbb4bbb4353535bb4535bb4535353bbb4bbb34bbbbb5354bb535354bbbbb35354bb534bbb534bb3535355000000000000 373 | 0000000055353535353535bb4bbb453bb435bb4535353bb4353bbb4535bbbbb4bbb54bbbbb3534bb353534bbbbbb3534bb354bb5353535353555000000000000 374 | 0000000053535353535353bb4bbb435bb453bbb453535bbb435bbb4353bbbb44bbb34bbbbb5354bb5353534bbbbb5354bbb34bb3535353535350000000000000 375 | 0000000005353535353535bb44bb453bb435bbb435353bbb4535bb4535bbbb454bb544bbbb3534bbb535354bb4bb35354bb54bb5353535353500000000000000 376 | 0000000003535353535353bb43bbb4bbb4535bb4535353bb4353bb43534bb4534bbb5444445354bbb353534bb4bbb3534bb34bb3535bb3535300000000000000 377 | 0000000005353535353535bb453bb4bbb4353bb4353535bb4535bbb4353445354bbb35353535354bb535354bb54bb5354bb54bb54bbbbbb53500000000000000 378 | 0000000003535353535353bb435bbbbbbb435bbb435353bbb4535bbb4443535354bbbbb35353534bbb53534bb34bbb534bb34bb34bbbbbb35353000000000000 379 | 0000000035353535353535bb453bbbbbbb453bbb4535353bb4353bbbbbb4353534bbbbbb35353534bb35354bb534bb354bb54bb54bbbbbb53535000000000000 380 | 0000000353535353535353bb435bbbbbb45353bb4353535bb45353bbbbbbb45353444bbbb3535354bb53534bb354bbb34bb34bb34bbb4bb35353000000000000 381 | 0000000535353535353535bb453bbbbbb43535bb4535353bb435353535bbbb45353534bbbb353534bbb5354bb5354bb54bb54bb54bbb4bb53535000000000000 382 | 0000000353535353535353bb435bbbbbb45353bb4353535bbb435353535bbb435353534bbb535354bbb3534bb3534bb34bb34bb353534bb35353000000000000 383 | 000000053535353535353bbb4535bbbb453535bb4535353bbb4535353535bbb435444534bb3535354bb534bbb5354bb4bbb54bb535354bb53535000000000000 384 | 000000035353535353535bbb4353bbbb435353bb4353535bbb4353535353bbb454bbb353bbb353534bb354bb53534bbbbb534bb353534bb35353500000000000 385 | 000000053535353535353bb43535bbbb453535bb4535353bbb453bbb45353bb44bbbb5354bb535354bb534bb35354bbbbb354bbb3534bbb53535300000000000 386 | 000000035353535353535bb45353bbbb435353bb4353535bbb43bbbbb4535bb44bbbb3534bb353534bb354bb535354bbbb534bbb444bbb535353500000000000 387 | 0000000555555535bbb43bb43535bbbb453535bb4535353bbb45bbbbb4353bb44bbbb534bbb535354bb534bb353534bbbb3534bbbbbbbb353535300000000000 388 | 0000000555555353bbbb4bb453535bbb435353bb4bbb43bbb4535bbb4353bbb44bbb5354bbb34b534bb354bb535354bbbb5354bbbbbbb3535353500000000000 389 | 0000000555555535bbbbbbb435353bb4353535bb4bb435bbb43b4bbb453bbbb44bbb353bbb44bb44bbbbbbbb353534bbbb35354bbbb535353535500000000000 390 | 0000000000005353bbbbbbb453535bb453535bbbbbbb43bbb4bbbbbbbbbbbb434bbbbbbbbb54bbbbbbbb4bb3535354bbbb535353535353535353500000000000 391 | 0000000000353535bbbbbbb435353bb435353bbbbbbbbbbbbbbbb4bbbbbbb43534bbbbbbb43544bbbbb44bb5353534bbb5353535353535353535000000000000 392 | 0000000353535353bbbbbb4353535b4353535bbbbb4bbbbbbb444344444443535344bbb44353534444434bb3535354bbb3535353535353535353000000000000 393 | 00000035353535354444443535353435353535444434444444353535353535353535444535353535353535353535353535353535353535353535000000000000 394 | 00000053535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535353535355000000000000 395 | 00000035353535353535353535353535353535353535353535353535353535353555555555555535353535353535353535353535353535555555000000000000 396 | 00000053535353535353535353535353535353535353535353555555555555555555555555555555555555555555555555555555555555555550000000000000 397 | 00000035555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555550000000000000 398 | 00000055555555555555555555555555555555555555555555555555555555555000000000000055555555555555555555555555555550000000000000000000 399 | 00000055555555555555555555555555555555555555555555555000000000000000000000000000000000000000000000000000000000000000000000000000 400 | 00000055500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 401 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 402 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 403 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 404 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 405 | 00000000000000000000000000000000000000999999999999999999999999999999999aaaaaaaaaaaaaaaaaa000000000000000000000000000000000000000 406 | 00000000000000000000000000000000000009955555555555555555555555555555555444444444444444449900000000000000000000000000000000000000 407 | 000000000000000000000000000000000000995999999999999999999999999999999aaaaaaaaaaaaaaaaaa95990000000000000000000000000000000000000 408 | 0000000000000000000000000000000000009599dddddddd99999999999999dd9dd9aaaaaaaaaaaaaaaaaa999590000000000000000000000000000000000000 409 | 000000000000000000000000000000000000959d66666667d999999999999d66d67daaaaaaaaaaaaaaaaa9999590000000000000000000000000000000000000 410 | 0000000000000000000000000000000000009599d66666777d99999999ddddd6dd7daaddddaaaaaaaaa999999590000000000000000000000000000000000000 411 | 0000000000000000000000000000000000009599d66dddd77d99999999d66dd7dd7ddad77daaaaaaaa9999999590000000000000000000000000000000000000 412 | 0000000000000000000000000000000000009599d66dddd66d99999999d77dd777777dd77daaaaaa999999999590000000000000000000000000000000000000 413 | 0000000000000000000000000000000000009599d66776666ddd999ddaddddd7dd7ddadddddadddd9dddd9999590000000000000000000000000000000000000 414 | 0000000000000000000000000000000000009599d6776666dd66d9d67d777dd7dd7dad677d7d7776d6666d999590000000000000000000000000000000000000 415 | 0000000000000000000000000000000000009599d77ddd666dd6d9d77dd77dd7dd7d9ad77dd7776666dd66d99590000000000000000000000000000000000000 416 | 0000000000000000000000000000000000009599d66d99d666d6d9d77dd77dd7dd6daad77dd77dd66666dd9a9590000000000000000000000000000000000000 417 | 0000000000000000000000000000000000009599d66d99d666d6dad77dd77dd6dd7ddad77dd6d9d66dd667da9590000000000000000000000000000000000000 418 | 0000000000000000000000000000000000009599d66dddd666d67d777dd77dd6dd7d7dd77dd6d9d66dddd7d99590000000000000000000000000000000000000 419 | 000000000000000000000000000000000000959d66666666dd9d777d777766667d777d7766666d6666667d999590000000000000000000000000000000000000 420 | 0000000000000000000000000000000000009599dddddddd9aaadddaddddddddddddddddddddddddddddd9999590000000000000000000000000000000000000 421 | 000000000000000000000000000000000000995999999999aaaaaaaaaa9999aaaaaaaaa99999999999a999995990000000000000000000000000000000000000 422 | 00000000000000000000000000000000000009955555555544444444445555444444444455555555544555559900000000000000000000000000000000000000 423 | 0000000000000000000000000000000000000099999999aaaaaaaaaa99999aaaaaaaaaaa99999999999999999000000000000000000000000000000000000000 424 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 425 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 426 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 427 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 428 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 429 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 430 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 431 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 432 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 433 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 434 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 435 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 436 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 437 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 438 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 439 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 440 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 441 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 442 | 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 443 | __gff__ 444 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 445 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 446 | __map__ 447 | 0001000000000000000000000000000f10100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 448 | 000102030405060708090a0b0c0d0e0f10200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 449 | 001112131415161718191a1b1c1d1e1f20300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 450 | 002122232425262728292a2b2c2d2e2f30400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 451 | 003132333435363738393a3b3c3d3e3f40500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 452 | 004142434445464748494a4b4c4d4e4f50600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 453 | 005152535455565758595a5b5c5d5e5f60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 454 | 606162636465666768696a6b6c6d6e6f70000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 455 | 707172737475767778797a7b7c7d7e7f80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 456 | 808182838485868788898a8b8c8d8e8f90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 457 | 909192939495969798999a9b9c9d9e9fa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 458 | a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 459 | 0000b2b3b4b5b6b7b8b9babbbcbdbebfc0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 460 | 0000c2c3c4c5c6c7c8c9cacbcccdcecfd0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 461 | c0b1b2b3d4d5d6d7d8d9dadb00cdcecf00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 462 | 00c1c2c300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 463 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 464 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 465 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 466 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 467 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 468 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 469 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 470 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 471 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 472 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 473 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 474 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 475 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 476 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 477 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 478 | 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 479 | __sfx__ 480 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 481 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 482 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 483 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 484 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 485 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 486 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 487 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 488 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 489 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 490 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 491 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 492 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 493 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 494 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 495 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 496 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 497 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 498 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 499 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 500 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 501 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 502 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 503 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 504 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 505 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 506 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 507 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 508 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 509 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 510 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 511 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 512 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 513 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 514 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 515 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 516 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 517 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 518 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 519 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 520 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 521 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 522 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 523 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 524 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 525 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 526 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 527 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 528 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 529 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 530 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 531 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 532 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 533 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 534 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 535 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 536 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 537 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 538 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 539 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 540 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 541 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 542 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 543 | 001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 544 | __music__ 545 | 00 01424344 546 | 00 41424344 547 | 00 41424344 548 | 00 41424344 549 | 00 41424344 550 | 00 41424344 551 | 00 41424344 552 | 00 41424344 553 | 00 41424344 554 | 00 41424344 555 | 00 41424344 556 | 00 41424344 557 | 00 41424344 558 | 00 41424344 559 | 00 41424344 560 | 00 41424344 561 | 00 41424344 562 | 00 41424344 563 | 00 41424344 564 | 00 41424344 565 | 00 41424344 566 | 00 41424344 567 | 00 41424344 568 | 00 41424344 569 | 00 41424344 570 | 00 41424344 571 | 00 41424344 572 | 00 41424344 573 | 00 41424344 574 | 00 41424344 575 | 00 41424344 576 | 00 41424344 577 | 00 41424344 578 | 00 41424344 579 | 00 41424344 580 | 00 41424344 581 | 00 41424344 582 | 00 41424344 583 | 00 41424344 584 | 00 41424344 585 | 00 41424344 586 | 00 41424344 587 | 00 41424344 588 | 00 41424344 589 | 00 41424344 590 | 00 41424344 591 | 00 41424344 592 | 00 41424344 593 | 00 41424344 594 | 00 41424344 595 | 00 41424344 596 | 00 41424344 597 | 00 41424344 598 | 00 41424344 599 | 00 41424344 600 | 00 41424344 601 | 00 41424344 602 | 00 41424344 603 | 00 41424344 604 | 00 41424344 605 | 00 41424344 606 | 00 41424344 607 | 00 41424344 608 | 00 41424344 609 | -------------------------------------------------------------------------------- /test.lua: -------------------------------------------------------------------------------- 1 | missing = require('package_missing') 2 | 3 | describe("missing -setmetatable-", function() 4 | it("should set a metatable", function() 5 | local Test_missing = {} 6 | Test_missing.__index = Test_missing 7 | function Test_missing:_init (name) 8 | self.name = name 9 | end 10 | local Test_native = {} 11 | Test_native.__index = Test_missing 12 | function Test_native:_init (name) 13 | self.name = name 14 | end 15 | local mt = { 16 | __call = function (cls, ...) 17 | local self = setmetatable({}, cls) 18 | self:_init(...) 19 | return self 20 | end 21 | } 22 | 23 | setmetatable(Test_native, mt) 24 | missing.setmetatable(Test_missing, mt) 25 | assert.are.equals( 26 | getmetatable(Test_native), 27 | getmetatable(Test_missing) 28 | ) 29 | assert.truthy(Test_native("native")) 30 | assert.truthy(Test_missing("missing")) 31 | end) 32 | end) 33 | 34 | describe("missing -getmetatable-", function() 35 | it("should get a metatable", function() 36 | local Test = {} 37 | Test.__index = Test 38 | local mt = { 39 | __call = function (cls, ...) 40 | local self = setmetatable({}, cls) 41 | return self 42 | end 43 | } 44 | missing.setmetatable(Test, mt) 45 | assert.are.equals( 46 | getmetatable(Test), 47 | missing.getmetatable(Test) 48 | ) 49 | end) 50 | end) 51 | 52 | describe("missing -rawget-", function() 53 | it("should get raw value", function () 54 | local setValue = 125 55 | local Test = { 56 | value = setValue 57 | } 58 | local defaultValue = "#default" 59 | local mt = { 60 | __index = function (tbl, key) 61 | return defaultValue 62 | end 63 | } 64 | missing.setmetatable(Test, mt) 65 | assert.are.equals( 66 | Test.doNotExist, 67 | defaultValue 68 | ) 69 | assert.are.equals( 70 | rawget(Test, 'doNotExist'), 71 | nil 72 | ) 73 | assert.are.equals( 74 | rawget(Test, 'doNotExist'), 75 | missing.rawget(Test, 'doNotExist') 76 | ) 77 | assert.are.equals( 78 | missing.rawget(Test, 'value'), 79 | setValue 80 | ) 81 | end) 82 | end) 83 | 84 | describe("missing -unpack-", function() 85 | it("should unpack table", function() 86 | local unpack_table = {1,2,3,4,5} 87 | local unpack_i = 0 88 | local unpack_j = 0 89 | local a, b, c, d, e, f, g, h = missing.unpack(unpack_table) 90 | local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table) 91 | assert.are.equals(a, _a) 92 | assert.are.equals(b, _b) 93 | assert.are.equals(c, _c) 94 | assert.are.equals(d, _d) 95 | assert.are.equals(e, _e) 96 | assert.are.equals(f, _f) 97 | assert.are.equals(g, _g) 98 | assert.are.equals(h, _h) 99 | end) 100 | 101 | it("should unpack table with i as argument", function() 102 | local unpack_table = {1,2,3,4,5} 103 | local unpack_i = 3 104 | local unpack_j = 0 105 | local a, b, c, d, e, f, g, h = missing.unpack(unpack_table, unpack_i) 106 | local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table, unpack_i) 107 | assert.are.equals(a, _a) 108 | assert.are.equals(b, _b) 109 | assert.are.equals(c, _c) 110 | assert.are.equals(d, _d) 111 | assert.are.equals(e, _e) 112 | assert.are.equals(f, _f) 113 | assert.are.equals(g, _g) 114 | assert.are.equals(h, _h) 115 | end) 116 | 117 | it("should unpack table with negative i as argument", function() 118 | local unpack_table = {1,2,3,4,5} 119 | local unpack_i = -2 120 | local unpack_j = 0 121 | local a, b, c, d, e, f, g, h = missing.unpack(unpack_table, unpack_i) 122 | local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table, unpack_i) 123 | assert.are.equals(a, _a) 124 | assert.are.equals(b, _b) 125 | assert.are.equals(c, _c) 126 | assert.are.equals(d, _d) 127 | assert.are.equals(e, _e) 128 | assert.are.equals(f, _f) 129 | assert.are.equals(g, _g) 130 | assert.are.equals(h, _h) 131 | end) 132 | 133 | it("should unpack table with i > #unpack_table as argument", function() 134 | local unpack_table = {1,2,3,4,5} 135 | local unpack_i = 8 136 | local unpack_j = 0 137 | local a, b, c, d, e, f, g, h = missing.unpack(unpack_table, unpack_i) 138 | local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table, unpack_i) 139 | assert.are.equals(a, _a) 140 | assert.are.equals(b, _b) 141 | assert.are.equals(c, _c) 142 | assert.are.equals(d, _d) 143 | assert.are.equals(e, _e) 144 | assert.are.equals(f, _f) 145 | assert.are.equals(g, _g) 146 | assert.are.equals(h, _h) 147 | end) 148 | 149 | it("should unpack table with i and j as argument", function() 150 | local unpack_table = {1,2,3,4,5} 151 | local unpack_i = 3 152 | local unpack_j = 5 153 | local a, b, c, d, e, f, g, h = missing.unpack(unpack_table, unpack_i, unpack_j) 154 | local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table, unpack_i, unpack_j) 155 | assert.are.equals(a, _a) 156 | assert.are.equals(b, _b) 157 | assert.are.equals(c, _c) 158 | assert.are.equals(d, _d) 159 | assert.are.equals(e, _e) 160 | assert.are.equals(f, _f) 161 | assert.are.equals(g, _g) 162 | assert.are.equals(h, _h) 163 | end) 164 | 165 | it("should unpack table with negative i and j as argument", function() 166 | local unpack_table = {1,2,3,4,5} 167 | local unpack_i = -1 168 | local unpack_j = 3 169 | local a, b, c, d, e, f, g, h = missing.unpack(unpack_table, unpack_i, unpack_j) 170 | local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table, unpack_i, unpack_j) 171 | assert.are.equals(a, _a) 172 | assert.are.equals(b, _b) 173 | assert.are.equals(c, _c) 174 | assert.are.equals(d, _d) 175 | assert.are.equals(e, _e) 176 | assert.are.equals(f, _f) 177 | assert.are.equals(g, _g) 178 | assert.are.equals(h, _h) 179 | end) 180 | 181 | it("should unpack table with i > #unpack_table and j as argument", function() 182 | local unpack_table = {1,2,3,4,5} 183 | local unpack_i = 10 184 | local unpack_j = 4 185 | local a, b, c, d, e, f, g, h = missing.unpack(unpack_table, unpack_i, unpack_j) 186 | local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table, unpack_i, unpack_j) 187 | assert.are.equals(a, _a) 188 | assert.are.equals(b, _b) 189 | assert.are.equals(c, _c) 190 | assert.are.equals(d, _d) 191 | assert.are.equals(e, _e) 192 | assert.are.equals(f, _f) 193 | assert.are.equals(g, _g) 194 | assert.are.equals(h, _h) 195 | end) 196 | 197 | it("should unpack table with negative i and negative j as argument", function() 198 | local unpack_table = {1,2,3,4,5} 199 | local unpack_i = -1 200 | local unpack_j = -6 201 | local a, b, c, d, e, f, g, h = missing.unpack(unpack_table, unpack_i, unpack_j) 202 | local _a, _b, _c, _d, _e, _f, _g, _h = unpack(unpack_table, unpack_i, unpack_j) 203 | assert.are.equals(a, _a) 204 | assert.are.equals(b, _b) 205 | assert.are.equals(c, _c) 206 | assert.are.equals(d, _d) 207 | assert.are.equals(e, _e) 208 | assert.are.equals(f, _f) 209 | assert.are.equals(g, _g) 210 | assert.are.equals(h, _h) 211 | end) 212 | end) 213 | 214 | describe("missing -ipairs-", function() 215 | it("should iterate a table with i,v as for values", function() 216 | local test_table = {2,4,8,16,32,64,128,256,512,1024} 217 | for i,v in ipairs(test_table) do 218 | assert.are.equals(2^i, v) 219 | end 220 | for i,v in missing.ipairs(test_table) do 221 | assert.are.equals(2^i, v) 222 | end 223 | end) 224 | 225 | it("should return a iter function", function() 226 | local test_table = {2,4,8,16,32,64,128,256,512,1024} 227 | iter, i, v = missing.ipairs(test_table) 228 | assert.are.equals(type(iter), 'function') 229 | end) 230 | end) 231 | 232 | describe("missing -table.pack-", function() 233 | it("should pack", function() 234 | local test_table_native = table.pack(-1,0,1,2,3,4,5) 235 | local test_table_missing = missing.table.pack(-1,0,1,2,3,4,5) 236 | for i,v in ipairs(test_table_native) do 237 | assert.are.equals(test_table_native[i], test_table_missing[i]) 238 | end 239 | end) 240 | end) 241 | 242 | describe("missing -table.insert-", function() 243 | it("should insert a value in a simple table", function() 244 | local function generate_table() 245 | return {22,-20,67,1009,-500} 246 | end 247 | local test_table_native = generate_table() 248 | local test_table_missing = generate_table() 249 | table.insert(test_table_native, 10) 250 | missing.table.insert(test_table_missing, 10) 251 | for i,v in ipairs(test_table_native) do 252 | assert.are.equals(test_table_native[i], test_table_missing[i]) 253 | end 254 | end) 255 | 256 | it("should insert a value at specified pos in a table", function() 257 | local function generate_table() 258 | return {-3,-2,-1,0,2,3} 259 | end 260 | local test_table_native = generate_table() 261 | local test_table_missing = generate_table() 262 | table.insert(test_table_native, 5, 1) 263 | missing.table.insert(test_table_missing, 5, 1) 264 | for i,v in ipairs(test_table_native) do 265 | assert.are.equals(test_table_native[i], test_table_missing[i]) 266 | end 267 | end) 268 | end) 269 | 270 | describe("missing -table.remove-", function() 271 | it("should remove an element from a given table", function() 272 | local function generate_table() 273 | return {-3,-2,-1,0,1,2,3} 274 | end 275 | local test_table_native = generate_table() 276 | local test_table_missing = generate_table() 277 | table.remove(test_table_native) 278 | missing.table.remove(test_table_missing) 279 | for i,v in ipairs(test_table_native) do 280 | assert.are.equals(test_table_native[i], test_table_missing[i]) 281 | end 282 | end) 283 | 284 | it("should remove an specified element from a given table", function() 285 | local function generate_table() 286 | return {-3,-2,-1,0,1,2,3} 287 | end 288 | local test_table_native = generate_table() 289 | local test_table_missing = generate_table() 290 | table.remove(test_table_native, 1) 291 | missing.table.remove(test_table_missing, 1) 292 | for i,v in ipairs(test_table_native) do 293 | assert.are.equals(test_table_native[i], test_table_missing[i]) 294 | end 295 | end) 296 | end) 297 | 298 | describe("missing -table.sort-", function() 299 | it("should sort a simple table", function() 300 | local function generate_table() 301 | return {33,3,333,87,13,252,-29} 302 | end 303 | local test_table_native = generate_table() 304 | local test_table_missing = generate_table() 305 | table.sort(test_table_native) 306 | missing.table.sort(test_table_missing) 307 | for i,v in ipairs(test_table_native) do 308 | assert.are.equals(test_table_native[i], test_table_missing[i]) 309 | end 310 | end) 311 | 312 | it("should sort a simple table with a given comp function", function() 313 | local function generate_table() 314 | return {33,3,333,87,13,252,-29} 315 | end 316 | local function desc(a, b) 317 | return a > b 318 | end 319 | local test_table_native = generate_table() 320 | local test_table_missing = generate_table() 321 | table.sort(test_table_native, desc) 322 | missing.table.sort(test_table_missing, desc) 323 | for i,v in ipairs(test_table_native) do 324 | assert.are.equals(test_table_native[i], test_table_missing[i]) 325 | end 326 | end) 327 | end) 328 | --------------------------------------------------------------------------------