Skip to content
Guest Big Announcement

Finding timer offset

Featured Replies

An example of linked list class lua script is this

Linked List Class
 
List = {}
List.__index = List
 
function List:new()
  local l = { head = {}, tail = {}, size = 0 }
  l.head.__next, l.tail.__prev = l.tail, l.head
  return setmetatable(l, self)
end
 
function List:first()
  if self.size > 0 then
    return self.head.next
  else
    return nil
  end
end
 
function List:addFirst(elem)
   local node = { prev = self.head, value = elem,
                        next = self.head.next }
   node.next.prev = node
   self.head.next = node
   self.size = self.size + 1
end
 
mylist = List:new()
mylist:addFirst(12)
print(mylist:first())

 

This is just so you know what your getting yourself into

Updated by XxGam3Ma2t3rxX

  • Author

An example of linked list class lua script is this

Linked List Class
 
List = {}
List.__index = List
 
function List:new()
  local l = { head = {}, tail = {}, size = 0 }
  l.head.__next, l.tail.__prev = l.tail, l.head
  return setmetatable(l, self)
end
 
function List:first()
  if self.size > 0 then
    return self.head.next
  else
    return nil
  end
end
 
function List:addFirst(elem)
   local node = { prev = self.head, value = elem,
                        next = self.head.next }
   node.next.prev = node
   self.head.next = node
   self.size = self.size + 1
end
 
mylist = List:new()
mylist:addFirst(12)
print(mylist:first())

 

This is just so you know what your getting yourself into

lol. Thanks anyways. I will update you.

Create an account or sign in to comment

Featured Content

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.