Log In  

Cart #dyninclude-3 | 2024-03-28 | Embed ▽ | License: CC4-BY-NC-SA
3

Script to dynamically include libraries, use dynInclude() instead of include()
You only need to specify the library name and it will be auto downloaded and installed if not currently installed then included automatically.

A simple and easy way to include libraries in your cart without the hassle.

Will try to load libaries from the following locations in this order:
1 - ./lib
2 - /appdata/system/lib
3 - /system/lib
4 - The BBS system (Will attempt to download and install the library to /appdata/system/lib

Usage:
The below code will include the basexx library, automatically downloading and installing it if necessary

include("./dynInclude.lua")
dynInclude("basexx")

string = "hello world"
print("Raw: " .. string)
print("Bit (Base2)" .. basexx.to_bit(string))
print("Hex (Base16) " .. basexx.to_hex(string))
print("Base32 " .. basexx.to_base32(string))
print("Base64 " .. basexx.to_base64(string))
print("Crockford " .. basexx.to_crockford(string))

Use load #dyninclude to load an example cartidge (Also contains dynInclude.lua)

See https://github.com/PyroChiliarch/picoDynInclude/ for an example cart that uses dynInclude()
See https://github.com/PyroChiliarch/picoBasexx/blob/main/src/main.lua for an example installer that is compatible with dynInclude

(Installers just need to copy <name>.lua to /appdata/system/lib to be compatible)

  • Version 3
    Fixed Typo

  • Version 2
    Fixed Typo
P#144273 2024-03-24 04:27 ( Edited 2024-03-28 12:39)


[Please log in to post a comment]