Advertisement
Oleshe

NumLua

Jan 29th, 2023 (edited)
697
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.51 KB | Software | 0 0
  1. local numlua = {}
  2. local help = math.exp(1)
  3. local toend = 0
  4. function numlua.array(...)
  5.   return {...}
  6. end
  7. function numlua.exp(array)
  8.   if type(array) == 'table' then
  9.     toend = {}
  10.     for i=1,#array do
  11.       toend[i] = help ^ array[i]
  12.     end
  13.   elseif type(array) == 'number' then
  14.     toend = 0
  15.     toend = help ^ array
  16.   end
  17.   return toend
  18. end
  19. function numlua.dot(array1,array2)
  20.   toend = 0
  21.   for i=1,#array1 do
  22.     toend = toend + array1[i] * array2[i]
  23.   end
  24.   return toend
  25. end
  26. return numlua
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement