aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/iface.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2009-02-08 13:34:59 -0500
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2009-02-08 13:34:59 -0500
commit33e9c58f408be3c42144b28464a029902580031d (patch)
tree6fe946e6931fd2454545dfd34ba84801b207ec33 /core/iface.lua
parent25b785dfc7f125b66a6ed1fc7b661a2435dc7bf0 (diff)
Cleaned up code, used argchecks instead of Lua errors, and enhanced stability.
Instead of throwing luaL_error() for bad arguments, use luaL_argcheck() and luaL_argerror() for more descriptive messages. Store the 'textadept' table's 'buffers', 'views', 'constants', 'buffer_functions', and 'buffer_properties' tables in the Lua registry and refer to them via metatables so that overwrites are not possible; removed 'rawset' for Lua scripts.
Diffstat (limited to 'core/iface.lua')
-rw-r--r--core/iface.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/iface.lua b/core/iface.lua
index 1281af32..0fa2b407 100644
--- a/core/iface.lua
+++ b/core/iface.lua
@@ -1,4 +1,4 @@
-textadept.constants = {
+local constants = {
CARETSTYLE_BLOCK = 2,
CARETSTYLE_INVISIBLE = 0,
CARETSTYLE_LINE = 1,
@@ -475,8 +475,9 @@ textadept.constants = {
SCN_INDICATORCLICK = 2023,
SCN_INDICATORRELEASE = 2024,
}
+rawset(textadept, 'constants', constants)
-textadept.buffer_functions = {
+local buffer_functions = {
add_ref_document = {2376, 0, 0, 1},
add_styled_text = {2002, 0, 2, 9},
add_text = {2001, 0, 2, 7},
@@ -723,8 +724,9 @@ textadept.buffer_functions = {
zoom_in = {2333, 0, 0, 0},
zoom_out = {2334, 0, 0, 0},
}
+rawset(textadept, 'buffer_functions', buffer_functions)
-textadept.buffer_properties = {
+local buffer_properties = {
anchor = {2009, 2026, 3, 0},
auto_c_auto_hide = {2119, 2118, 5, 0},
auto_c_cancel_at_start = {2111, 2110, 5, 0},
@@ -861,3 +863,4 @@ textadept.buffer_properties = {
x_offset = {2398, 2397, 1, 0},
zoom = {2374, 2373, 1, 0},
}
+rawset(textadept, 'buffer_properties', buffer_properties)