Search
 
SCRIPT & CODE EXAMPLE
 

LUA

Lua Stack

-- OOP boilerplate - create a class, add __index, then make a constructor
Stack = {}
Stack.__index = Stack
function Stack.new() return setmetatable({}, Stack) end
 
-- put a new object onto a stack
function Stack:push(input)
	self[#self+1] = input
end
-- take an object off a stack
function Stack:pop()
	assert(#self > 0, "Stack underflow")
	local output = self[#self]
	self[#self] = nil
	return output
end
Comment

PREVIOUS NEXT
Code Example
Lua :: lua patterns 
Lua :: roblox create part script 
Lua :: lua prin type of variable 
Lua :: lua coding lines to test with 
Lua :: lua hash keys 
Lua :: lua to float 
Lua :: lua class example 
Lua :: lua table of alphabet 
Matlab :: matlab title figure 
Matlab :: matlab plot vertical line 
Matlab :: matlab for loop syntax 
Matlab :: matlab symbolic roots 
Matlab :: matlab tf get poles 
Basic :: how to open d drive using conda prompt 
Basic :: convert c++ code to c online 
Basic :: how to simulate tail in dos/cmd without tail 
Elixir :: elixir get_in 
Elixir :: elixir check is nil 
Scala :: scala get file from url as string 
Scala :: scala remove element from list 
Scala :: how to tell what type a variable is scala 
Excel :: google sheets select item from split 
Excel :: google sheets apply formula to entire column 
Perl :: perl mechanize infinite scroll 
Pascal :: pascal loop 
Powershell :: change increase windows scroll bar slider width 
Abap :: abap concatenate 
Assembly :: 64 bit assembly Hello world 
Assembly :: assembly mov char 
Javascript :: jquery vslidation remove spaces from input 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =