Module proxy_table
allows the creation of a "proxy" for a real table or structure of tables which prevents modification but inheriting the values of the parent table.
constructor accepts a custom function for handling attempts to change the value of fields. Defaults to an error message.
This works with a given tree of tables.
Functions
set_field_override (proxy, key, value) | sets an override on the proxy's fields. |
new (table, newindex_handling_func) | create a new proxy table |
is_proxy (value) | check if its a proxy table |
Functions
- set_field_override (proxy, key, value)
-
sets an override on the proxy's fields. You can use this in the
newindex_handling_func
param to allow proxy tables to be modifiedParameters:
- proxy proxy the proxy table
- key
- value
- new (table, newindex_handling_func)
-
create a new proxy table
Parameters:
- table table to create immutable interface for
- newindex_handling_func
functions
function(proxy, original_object, key, value)
to call when the proxy table has an attempted set
Returns:
-
Proxy table
- is_proxy (value)
-
check if its a proxy table
Parameters:
- value value it check if proxy
Returns:
-
bool