Lua string.split

lua string.split function Split(s, delimiter) result = {}; for match in (s..delimiter):gmatch(“(.-)”..delimiter) do table.insert(result, match); end return result; end split_string = Split(“Hello World!”, ” “) — split_string[1] = “Hello” — split_string[2] = “World!”

Lua string.split Read More

Lua string split

lua string split function stringsplit(inputstr, sep) if sep == nil then sep = “%s” end local t={} i=1 for str in string.gmatch(inputstr, “([^”..sep..”]+)”) do t[i] = str i = i + 1 end return t end

Lua string split Read More

Lua scripts

Lua scripts Lua is a powerful, efficient, lightweight, embeddable scripting language. It supports procedural programming, object-oriented programming, functional programming, data-driven programming, and data description. Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode with a register-based virtual machine, and […]

Lua scripts Read More

Lua raycasting

lua raycasting EXPAND local function fireLaser() — Set an origin and directional vector local rayOrigin = caster.Position local rayDirection = Vector3.new(0, -100, 0) — Build a “RaycastParams” object and cast the ray local raycastParams = RaycastParams.new() raycastParams.FilterDescendantsInstances = {caster.Parent} raycastParams.FilterType = Enum.RaycastFilterType.Blacklist local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams) if raycastResult then local hitPart = raycastResult.Instance […]

Lua raycasting Read More