using module and passing variables through function

Hi,

I’am not sure to understand module insertion.

I have a main.lua with :

local a= 3  
local b= 4  
paquet = require "paquet01"  
local c = paquet:produit(a,b)  
print (a.." x "..b.."=".."c")  
  

and a module file, named “paquet01.lua” :

module(..., package.seeall)  
  
function produit(a,b)  
 c=a\*b  
 return c  
end  

The error code says :
[blockcode]
paquet01.lua:4: attempt to perform arithmetic on local ‘a’ (a table value)
[/blockcode]

I do not understand why “a” is a table and how to pass variable to a function in another lua file.
[import]uid: 5578 topic_id: 20992 reply_id: 320992[/import]

Eureka !

Changed line 4 to :

  
local c = paquet.produit(a,b)  

a . instead of a :

[import]uid: 5578 topic_id: 20992 reply_id: 82922[/import]

Yep you have to watch out for : and .

If you declared the function like

[code]
local public = {}

function public:myFunc(a,b)
end

return public

–then you could call it like

local pub = require(“mymodule”)

pub:myFunc()
[import]uid: 84637 topic_id: 20992 reply_id: 82989[/import]