Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Creating habits v3, Lua
--[[ Creating habits v3 Lua ]]-- local array1 = {"tset1", "26", "jsdfl"} -- Creates an array of strings -- local function test(x) if x ~= nil then -- Checks if x isn't nil -- table.insert(array1, tostring(x)) -- If x isn't nil, insert a string -- end local str = ""; -- Creates an empty string -- for _,v in pairs (array1) do -- Goes thorugh array1 and inserts them into "str" -- str = str.. " "..tostring(v) -- Inserts "v" (What's in the array) into "str" -- end if x ~= nil then table.remove(array1, #array1) -- Removes the inserted string (if there was one) -- end return str -- Returns the completed "str" -- end print(test(56)) -- Runs and prints the function -- 56 gets inserted into the array, then gets removed -- print("\n".. test()) -- Creates a new line and runs the function again w/o inserting something into the table --
run
|
edit
|
history
|
help
0
sh
Surface Area of things (Incomplete)
RSA KEY GENERATOR (LUA)
10 Line challenge
Exponential from Two Points
ok
Replace all substring in string
Lua Angle Cheatsheet
cumulative probability
Area of Sector Calculator