lua-users home
lua-l archive

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


>>
>> Is there going to be syntax for constructing "really string" literals?
>> If not, it can be implemented as a library operating on userdata,
>> rather like the `file:` functions.
>>
>> Which metamethods should it have?
>>
>> len, concat: like string
>> eq, le, lt: actual comparisons
>> add: bitwise `or`
>> sub: bitwise `nor`
>> mul: bitwise `and`
>> div: bitwise `nand`
>> unm: bitwise `not`
>> index: access to a byte
>> newindex: changing a byte
>
> If two string is not same length, then how to define these binary operations?
>
Two possiblities:

  - it is an error
  - the shorter string defines the length of the result

Which do you prefer?