From 3a075f4bc716550e0a621a2db40cfa578db1d0fa Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Tue, 11 Sep 2012 19:17:24 +0400 Subject: Trivial siege engine aiming at units, with logic in lua. --- library/include/LuaTools.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'library') diff --git a/library/include/LuaTools.h b/library/include/LuaTools.h index 6b1afb88..3330e23e 100644 --- a/library/include/LuaTools.h +++ b/library/include/LuaTools.h @@ -287,6 +287,11 @@ namespace DFHack {namespace Lua { PushDFObject(state, ptr); } + template inline void SetField(lua_State *L, T val, int idx, const char *name) { + if (idx < 0) idx = lua_absindex(L, idx); + Push(L, val); lua_setfield(L, idx, name); + } + template void PushVector(lua_State *state, const T &pvec, bool addn = false) { -- cgit v1.2.1