Skip to content

Commit

Permalink
add missing helpers and libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Feb 8, 2024
1 parent 2ca7f10 commit cbc3284
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion src/luacheck/builtin_standards/minetest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,25 @@ local minetest = {
-- Error Handling
error_handler = read_write,

-- Helper functions
wrap_text = empty,
pos_to_string = empty,
string_to_pos = empty,
string_to_area = empty,
is_yes = empty,
is_nan = empty,
get_us_time = empty,
pointed_thing_to_face_pos = empty,
get_tool_wear_after_use = empty,
get_dig_params = empty,
get_hit_params = empty,
colorize = empty,

-- Translations
get_translator = empty,
get_translated_string = empty,
translate = empty,

-- Global tables
registered_items = read_write,
registered_nodes = read_write,
Expand All @@ -363,20 +382,39 @@ local minetest = {
}

-- Table additions
local table = standards.def_fields("copy")
local table = standards.def_fields("copy", "indexof", "insert_all", "key_value_swap", "shuffle")

-- String additions
local string = standards.def_fields("split", "trim")

-- Math additions
local math = standards.def_fields("hypot", "sign", "factorial", "round")

-- Bit library
local bit = standards.def_fields("tobit","tohex","bnot","band","bor","bxor","lshift","rshift","arshift","rol","ror",
"bswap")

-- vector util
local vector = standards.def_fields("new", "zero", "copy", "from_string", "to_string", "direction", "distance",
"length", "normalize", "floor", "round", "apply", "combine", "equals", "sort", "angle", "dot", "cross", "offset",
"check", "in_area", "add", "subtract", "multiply", "divide", "rotate", "rotate_around_axis", "dir_to_rotation")

return {
read_globals = {
-- main namespace
minetest = minetest,

-- extensions
table = table,
math = math,
bit = bit,
string = string,

-- Helper functions
vector = vector,
dump = empty,
dump2 = empty,


-- classes
AreaStore = empty,
Expand Down

0 comments on commit cbc3284

Please sign in to comment.