summaryrefslogtreecommitdiff
path: root/library/LuaTypes.cpp
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-04-11 16:20:16 +0400
committerAlexander Gavrilov2012-04-11 16:20:16 +0400
commit61245711f7840a4d3c36739d5842180b95995136 (patch)
tree4524411ec53069d496e4ae11c011445de518f2de /library/LuaTypes.cpp
parentc7b922250b5e41cb78b8636a706fdc07be615974 (diff)
downloaddfhack-61245711f7840a4d3c36739d5842180b95995136.tar.gz
dfhack-61245711f7840a4d3c36739d5842180b95995136.tar.bz2
dfhack-61245711f7840a4d3c36739d5842180b95995136.tar.xz
Export a few maps functions to lua.
Diffstat (limited to 'library/LuaTypes.cpp')
-rw-r--r--library/LuaTypes.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/library/LuaTypes.cpp b/library/LuaTypes.cpp
index 2f9ef9e8..40269da8 100644
--- a/library/LuaTypes.cpp
+++ b/library/LuaTypes.cpp
@@ -80,6 +80,15 @@ void constructed_identity::lua_write(lua_State *state, int fname_idx, void *ptr,
{
invoke_assign(state, this, ptr, val_index);
}
+ // Allow by-value assignment for wrapped function parameters
+ else if (fname_idx == UPVAL_METHOD_NAME && lua_isuserdata(state, val_index))
+ {
+ void *nval = get_object_internal(state, this, val_index, false);
+ if (!nval)
+ field_error(state, fname_idx, "incompatible type in complex assignment", "write");
+ if (!copy(ptr, nval))
+ field_error(state, fname_idx, "no copy support", "write");
+ }
else
field_error(state, fname_idx, "complex object", "write");
}