lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> So, the bottom line seems to be that, in a 16-bit version, there can
> only be 29-30 functions in a chunk or inside another function.  Am I
> right?

Right. The opcode (see lopcodes.h)

OP_CLOSURE/*	A B	v_b-v_1		closure(KPROTO[a], v_1-v_b)	*/

uses A to tell which element to get from kproto array, so there can be
at most MAXARG_A elements. One way around this limitation is to nest
the function definitions inside other functions, as the limit is per function:


function createStr ()
  Str = {}
  function Str:disp () end 
  function Str:pack () end 
  function Str:unpack (s) end 
  function Str:clear () end 
  function Str:size () end 
  function Str:new (dim) end 
end

function createNum ()
  ...
end

...


-- Roberto