Commit Graph

28 Commits

Author SHA1 Message Date
Glenn Maynard 2c1ad45e84 helper 2006-11-14 04:16:35 +00:00
Steve Checkoway 4f4c6b5e87 Fix compile. 2006-11-03 05:33:43 +00:00
Glenn Maynard 083c20497c use LuaThreadVariable 2006-11-02 06:12:48 +00:00
Glenn Maynard 47d07b3cf2 remove unused 2006-10-13 08:24:43 +00:00
Glenn Maynard 4b30d3552d A bizarre C++ wart wants us to declare FromStack overloads
before the ThemeMetric templates that use them.  That's broken
and unreasonable, so change this around a bit and make FromStack
(and Push) templates.

Push() takes a bit of a trick.  Some Push overloads push the
actual value: scalars (int, float), RageColor (pushes a table).
Others--most of them--push a reference to a C++ object.  We
want the scalars to have a reference parameter type, so we
don't make extra copies of things like RageColor when we push
them.  We need to pass C++ objects by pointer (we need to
push the actual object's pointer, not a pointer to a copy).
Further, pushing a scalar is a const operation, but pushing
a reference to an object is not.

To do both with the same template, we handle objects with
this slightly odd template:

template<> void LuaHelpers::Push<T*>( lua_State *L, T *const &pObject );

The actual overload (T) is eg. "Actor*"; this fits within the
general prototype, "Push(lua_State *L, const T &object)", giving
us a const reference to a (non-const) pointer to Actor, and we're
conceptually pushing the pointer.

The net effect of this is that 1: what was before compile errors
now becomes link time errors, but 2: these specializations
don't have to be in the headers (except for new ones for
Preference and BroadcastOnChange).
2006-10-07 01:22:28 +00:00
Glenn Maynard 1f5114b193 LuaHelpers::FromStack binding for references 2006-09-22 19:46:30 +00:00
Glenn Maynard 85d8006257 remove LuaReference name; keep LuaReference lightweight 2006-09-22 09:46:31 +00:00
Glenn Maynard 81aa418b11 return error 2006-09-21 23:05:32 +00:00
Glenn Maynard 039e263fbc LuaExpression unused 2006-09-21 02:11:54 +00:00
Glenn Maynard fc510e7086 LuaExpression::SetFromExpression -> LuaReference::SetFromExpression 2006-09-21 02:06:42 +00:00
Glenn Maynard e0a68a235e eliminate LuaData type; move Serialize into LuaReference
Nothing uses Serialize right now.  I havn't decided whether
to keep it around.
2006-09-21 01:56:08 +00:00
Glenn Maynard e20eea62e9 flatten LuaTable -> LuaData -> LuaReference
to LuaTable -> LuaReference
2006-09-21 01:45:51 +00:00
Glenn Maynard d3e50d80c8 remove unused stuff
simplify ActorCommands

I thought about getting rid of m_sLuaFunction; it's not needed
anymore, and takes up memory (probably more memory than the
function itself), but I use it a lot to identify floating
references when I don't know what I'm looking at.  Store it
generically in LuaReference.
2006-09-21 01:19:18 +00:00
Glenn Maynard 7d1f669e93 remove unused LuaReference::BeforeResetAll, LuaReference::AfterResetAll 2006-09-21 00:00:57 +00:00
Chris Danford 037ed8ae51 CString -> RString 2005-12-27 17:11:38 +00:00
Glenn Maynard ba0eb8dba2 add LuaReference::DeepCopy 2005-08-29 06:30:44 +00:00
Glenn Maynard fee9e51b2c revert. Unregister() is "atomic" (useful to call without locking around it). 2005-06-21 02:41:35 +00:00
Glenn Maynard acbe82d877 pass L to Reset 2005-06-21 02:29:21 +00:00
Glenn Maynard 1e02955e63 correct locking semantics for LuaReference (SGameplay commit in a moment) 2005-06-16 03:13:06 +00:00
Glenn Maynard 627e5eb16a add LuaTable 2005-03-18 22:40:09 +00:00
Glenn Maynard 3e3bad9c9c fix LuaData becoming incorrectly set after a reset 2005-02-27 00:22:13 +00:00
Glenn Maynard b35d1c806e fix LuaReference::operator=
add LuaReference::IsNil
2005-02-23 06:17:29 +00:00
Glenn Maynard f406e52db3 add LuaReference::Unset; LuaExpression sets nothing by default (so LuaExpressoin is "free" if not actually used) 2005-02-22 03:25:38 +00:00
Glenn Maynard 725a50985f add constructor 2005-02-17 04:59:54 +00:00
Glenn Maynard 69383384bf add LuaData::Serialize, LuaData::LoadFromString; fix stack overflow 2005-02-16 02:42:05 +00:00
Glenn Maynard 6175a16f24 Add LuaData, a reference type that restores itself over Lua resets. This
works only with static data types that can be restored: tables, strings,
numbers, and not functions, userdata, etc.
2005-02-16 00:38:40 +00:00
Glenn Maynard e24c79048e add LuaReference::GetLuaType, LuaExpression 2005-02-14 01:31:10 +00:00
Glenn Maynard c423e070aa Move Lua reference handling into a generic base class. 2005-02-13 04:00:48 +00:00