This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "lua.h" | |
| #include "lualib.h" | |
| #include "lauxlib.h" | |
| /// Performs plain substring replacement, with no characters in `pattern` or `replacement` being considered magic. | |
| /// There is no support for `string.gsub`'s parameter `n` and second return in this version. | |
| /// @function string.replace | |
| /// @tparam string str | |
| /// @tparam string pattern | |
| /// @tparam string replacement |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import subprocess | |
| import tempfile | |
| import clang.cindex as clang | |
| def create_translation_unit_with_ast(source_file_path, clang_args=[], clang_exe='clang'): | |
| """ | |
| Create a `clang.TranslationUnit` for a source file by compiling it with clang as a | |
| subprocess instead of using `clang.Index.parse`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Detecting updated files for hot reloading in a LÖVE game | |
| local hotreload = {} | |
| -- Monitor the "src" and "assets" paths, can be changed to any existing folders in your project, separated by spaces | |
| local monitor_path = "src assets" | |
| -- External command for monitoring the filesystem | |
| -- Needs fswatch available for execution in PATH (no errors will be thrown, but reload will not work) | |
| -- https://github.com/emcrisostomo/fswatch | |
| local fswatch_cmd = "fswatch --recursive --event Updated " .. monitor_path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Returns false if value is falsey (`nil` or `false`), returns true if value is truthy (everything else) | |
| function toboolean(v) | |
| return v ~= nil and v ~= false | |
| end | |
| -- Returns true if one value is falsey and the other is truthy, returns false otherwise | |
| function xor(a, b) | |
| return toboolean(a) ~= toboolean(b) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Usage: for k, v in kpairs(t) do ... end | |
| local function knext(t, index) | |
| local value | |
| repeat | |
| index, value = next(t, index) | |
| until type(index) ~= 'number' | |
| return index, value | |
| end | |
| function kpairs(t) | |
| return knext, t, nil |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # FindReplxx | |
| # ------------- | |
| # Locate replxx library. This module defines: | |
| # | |
| # REPLXX_FOUND - true if replxx library was found | |
| # REPLXX_LIBRARIES - replxx library | |
| # REPLXX_INCLUDE_DIRS - where to find replxx.hxx and replxx.h | |
| # REPLXX_VERSION - the version of replxx found (parsed from header file) | |
| find_path(REPLXX_INCLUDE_DIRS NAMES replxx.hxx replxx.h PATH_SUFFIXES replxx/include) |
NewerOlder