string (Standard Lua) Functions: lower, upper, len, sub, format, rep, dump, char, find, byte, gmatch, unpack, packsize, pack, reverse, match, gsub Supported in MASSO software v5.13 & API Version: 1.0.0 Example: local line = "G1 X10.000 Y-3.500"
local up = string.upper("g54") -- "G54"
local n = string.len("Tool_12") -- 7
local xS = string.match(line, "X(-?%d+%.%d+)") -- "10.000"
local compact = string.gsub(line, "%s+", " ") -- normalize spaces
|
table (Standard Lua) Functions: concat, sort, insert, move, pack, unpack, remove Supported in MASSO software v5.13 & API Version: 1.0.0 Example: local axes = {"X10.0","Y-3.5","F1200"}
print("G1 " .. table.concat(axes, " "))
table.insert(axes, "Z1.0")
table.sort(axes) -- demo only
|
math (Standard Lua) Functions: random, deg, rad, exp, log, min, max, tan, sin, cos, sqrt, floor, ceil, acos, asin, atan, abs, type, ult, fmod, modf, tointeger, randomseed;
Constants: pi, huge, maxinteger, mininteger Supported in MASSO software v5.13 & API Version: 1.0.0 Example: math.randomseed(1234)
local angle = math.atan(10, 5) -- radians
local degs = math.deg(angle)
|
_G / Base functions Functions: pairs, rawget, rawset, rawequal, pcall, xpcall,warn, rawlen, loadfile, load, ipairs, next, assert,select, tonumber, collectgarbage, tostring, type, setmetatable, getmetatable, error;
Constant: _VERSION Supported in MASSO software v5.13 & API Version: 1.0.0 Example: local ok, err = pcall(function() error("boom") end)
if not ok then warn("Caught: "..tostring(err)) end
print("_VERSION:", _VERSION)
|