-1

In my cbi files I have:

local t=require"luci.model.network".init()
local e=require"luci.model.firewall".init()
local i=require"luci.util"
local e=require"luci.model.uci".cursor()

In the above syntax if i remove init() and cursor() then my program not work properly,need help why it's necessary

From where i can learn about init(),cursor() in luci and why they are necessary?

shamim
  • 6,640
  • 20
  • 85
  • 151

1 Answers1

0

Lua is not an object oriented language that supports constructors / destructors. But it is possible to achieve some similar functionality by defining init / new / whatever name you like to create an object and then operate on that instance. I'd suggest you read tutorials on lua-wiki about module creation and the LuCI source code to learn about what the init or cursor functions do.

Nilesh
  • 624
  • 1
  • 7
  • 23