Skip to content

Latest commit

 

History

History
15 lines (13 loc) · 304 Bytes

lua_override.md

File metadata and controls

15 lines (13 loc) · 304 Bytes

Overriding lua built-in functions

orig_len = string.len
function my_len(s)
  ts.error('len is '..s)
  return orig_len(s)
end

string.len = my_len
abc = 'abc'
ts.error('test len   '..abc:len())

We can then put restrictions on input parameters on these functions