Commit Graph

45 Commits

Author SHA1 Message Date
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 3130411629 use LuaHelpers::RunExpression 2006-09-22 19:45:37 +00:00
Glenn Maynard 85d8006257 remove LuaReference name; keep LuaReference lightweight 2006-09-22 09:46:31 +00:00
Glenn Maynard 04e9fcc2bf remove SubscriptionManager 2006-09-22 07:54:46 +00:00
Glenn Maynard bd2dd513b8 copy the name 2006-09-22 07:53:51 +00:00
Glenn Maynard 6f1dbf32d5 don't specify a dummy name for the expression, so RunScript
shows useful error messages
2006-09-22 04:25:38 +00:00
Glenn Maynard 9e96b44d55 oops, fixup 2006-09-21 23:15:24 +00:00
Glenn Maynard 235729f7b3 only set name if not set 2006-09-21 23:11:43 +00:00
Glenn Maynard 81aa418b11 return error 2006-09-21 23:05:32 +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 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 ec424ec51e fix conflicting globals during link 2006-01-07 06:02:47 +00:00
Chris Danford 8b0c7ac36e SubscriptionHandler -> SubscriptionManager 2006-01-06 20:19:30 +00:00
Chris Danford d55ae24611 add PseudoLocalize
phase out SubscriptionManager for SubscriptionHandler to fix ThemeManager assert
2006-01-06 20:18:15 +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 8166a4cd4a HiddenPtr<LuaReference> 2005-08-29 04:49:49 +00:00
Chris Danford 20b0a0801b cleanup 2005-08-29 00:55: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 25d7dea813 fix incorrect release 2005-06-16 09:23:52 +00:00
Glenn Maynard 914acb4b7b LuaHelpers::RunScript 2005-06-16 06:17:32 +00:00
Glenn Maynard fc16f2625d LuaManager::RunScript -> LuaHelpers::RunScript.
(Functions in LuaManager can accidentally bypass locking semantics, so
they should be kept to a minimum.)
2005-06-16 06:00:39 +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 8a5faeb248 fix copied references being set when the source reference was not 2005-02-22 03:22:56 +00:00
Glenn Maynard baf8ef940e RunScript cleanup, default to 0 return values 2005-02-22 01:21:38 +00:00
Glenn Maynard 6f88bf18c0 Cleanup: change RunExpression to a RunScript helper. Never tack on
"return "; the caller can do that if it wants.  Instead, just act as a helper to
display a generic dialog on error.
2005-02-17 05:46:31 +00:00
Glenn Maynard d6b13fb134 pronoun 2005-02-17 00:44:26 +00:00
Glenn Maynard 8a62baa1d1 cleanup 2005-02-17 00:41:30 +00:00
Glenn Maynard 45159de835 cleanup 2005-02-17 00:00:04 +00:00
Chris Danford 5492de16e4 fix VC6 compile 2005-02-16 03:29:11 +00:00
Glenn Maynard 69383384bf add LuaData::Serialize, LuaData::LoadFromString; fix stack overflow 2005-02-16 02:42:05 +00:00
Glenn Maynard 4376c828e5 fix LuaData::BeforeReset 2005-02-16 01:46:29 +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 0a0ad8714c allow LuaManager::RunExpression to return a function
show the filename when a full script has an error
use LuaManager::RunExpression in LuaExpression
2005-02-15 02:15:26 +00:00
Glenn Maynard ab39fa278e fix compile 2005-02-14 01:33:53 +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