-
Sergey Bronnikov authored
Running of automatically generated Lua programs sometimes failed due to semantic errors like: - "attempt to index" (16%) - "attempt to perform arithmetic on" (12%) - "attempt to call" (11%) - "attempt to concatenate" (3%) - "attempt to get length of" (1%) Example of an error "attempt to index" is the following: ``` Name0 = 'Name'; function Name0:Name4() end ``` These errors are happened because Lua objects have no appropriate metamethods and therefore these operations are not applicable: - "attempt to index": missed `__index` metamethod - "attempt to call": missed `__call` metamethod - "attempt to perform arithmetic on": missed metamethods that implements arithmetic operations - "attempt to get length of": missed `__len` metamethod - "attempt to concatenate": missed `__concat` metamethod The patch defines a Lua metatables [1] and set this metatables to a Lua values. 1. https://www.lua.org/manual/5.1/manual.html#2.8 NO_CHANGELOG=testing NO_DOC=testing NO_TEST=testing
Sergey Bronnikov authoredRunning of automatically generated Lua programs sometimes failed due to semantic errors like: - "attempt to index" (16%) - "attempt to perform arithmetic on" (12%) - "attempt to call" (11%) - "attempt to concatenate" (3%) - "attempt to get length of" (1%) Example of an error "attempt to index" is the following: ``` Name0 = 'Name'; function Name0:Name4() end ``` These errors are happened because Lua objects have no appropriate metamethods and therefore these operations are not applicable: - "attempt to index": missed `__index` metamethod - "attempt to call": missed `__call` metamethod - "attempt to perform arithmetic on": missed metamethods that implements arithmetic operations - "attempt to get length of": missed `__len` metamethod - "attempt to concatenate": missed `__concat` metamethod The patch defines a Lua metatables [1] and set this metatables to a Lua values. 1. https://www.lua.org/manual/5.1/manual.html#2.8 NO_CHANGELOG=testing NO_DOC=testing NO_TEST=testing