2022-06-10 21:28:33 +02:00
2022-06-10 20:54:44 +02:00
2022-06-09 23:40:58 +02:00
2022-06-10 20:27:23 +02:00
2022-06-10 02:30:59 +02:00
2022-06-07 01:46:17 +02:00
2022-06-09 23:40:58 +02:00
2022-06-09 23:40:58 +02:00
2022-06-10 02:30:59 +02:00
2022-06-09 23:40:58 +02:00
2022-06-10 21:28:33 +02:00

t5-gsc-utils

T5 version of t6-gsc-utils.
If you wish for any feature to be added please create an issue.

Installation

  • Download the latest version from the releases
  • Copy it to Plutonium/storage/t5/plugins

Features

  • Easily add almost any C++ function into GSC:

    C++

    {
        gsc::function::add("myfunc", [](int a, const std::string& b)
        {
            printf("%i %s\n", a, b.data());
        });
    }
    

    GSC

    init()
    {
        myFunc(1, "hello world");
    }
    
  • Non-primitive GSC types such as arrays and structs (soon) are also supported and can be implicitly converted to STL containers:

    C++

    {
        gsc::function::add("sort", [](std::vector<int> vec)
        {
            std::sort(vec.begin(), vec.end());
            return vec;
        });
    }
    

    GSC

    init()
    {
        arr = [];
        arr[arr.size] = 10;
        arr[arr.size] = 5;
        arr[arr.size] = 3;
        arr[arr.size] = 2;
        arr[arr.size] = 9;
    
        for (i = 0; i < arr.size; i++)
        {
            print_(arr[i]);
        }
    
        print_();
    
        arr = sort(arr);
    
        for (i = 0; i < arr.size; i++)
        {
          print_(arr[i]);
        }
    }
    

    More examples can be found here

Functions & Methods

A list of all the functions and methods that are added to the GSC VM by this plugin.

IO

  • fileExists(path): Returns true if the file exists.
  • writeFile(path, data[, append]): Creates a file if it doesn't exist and writes/appends text to it.
  • readFile(path): Reads a file.
  • fileSize(path): Returns file size in bytes.
  • createDirectory(path): Creates a directory.
  • directoryExists(path): Returns true if the directory exists.
  • directoryIsEmpty(path): Returns true if the directory is empty.
  • listFiles(path): Returns the list of files in the directory as an array.
  • copyFolder(source, target): Copies a folder.
  • copyDirectory(source, target): Same as copyFolder.
  • removeDirectory(path[, recursive): Removes a directory and optionally all its contents.

SOON

  • ...
Description
No description provided
Readme 1.4 MiB
Languages
C++ 99.1%
Lua 0.8%