Commit Graph
93 Commits
Author SHA1 Message Date
Glenn Maynard 3dc13b568a LuaManager::L -> m_pLuaMain 2006-10-14 20:49:35 +00:00
Glenn Maynard 89b435ef51 LuaManager::GetLuaInformation -> LuaHelpers::GetLuaInformation 2006-10-14 20:35:32 +00:00
Glenn Maynard d7776aba60 evaluate enums directly 2006-10-09 01:34:16 +00:00
Glenn Maynard 6322ded0dc move command parsing into LuaHelpers. It's not Actor-specific other
than a few compatibility hacks.
2006-10-08 22:24:15 +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 c80451fe46 fix stack imbalance 2006-10-06 00:46:06 +00:00
Glenn Maynard 47a1ab39bd add LuaHelpers::PushValueFunc 2006-10-05 19:57:07 +00:00
Glenn Maynard dcc1cb0d86 merge LuaFunctions.h into LuaManager.h 2006-09-29 09:31:41 +00:00
Steve Checkoway c89f3f9335 Don't bother getting the max. Just go until we find a nil element, that's all the # operator is going to do. 2006-09-26 09:35:15 +00:00
Glenn Maynard f567a0fd28 cleanup arg order 2006-09-26 08:54:54 +00:00
Steve Checkoway 9914f50ade Safe macros. (Probably only needed if the type of argument is not known at compile time and accessed with something other than a constant.) 2006-09-26 05:50:40 +00:00
Steve Checkoway 6fe6baa241 Unused. The purpose of this connivence function as stated in the comments (which isn't quite what it did) is exactly what RunExpression does. 2006-09-26 05:35:24 +00:00
Glenn Maynard 923f0f7346 inline 2006-09-26 01:36:31 +00:00
Glenn Maynard 78c8e11290 add LuaHelpers::AbsIndex 2006-09-26 01:28:10 +00:00
Glenn Maynard 1554e02329 always use our headers 2006-09-25 07:36:14 +00:00
Glenn Maynard de88aa1d94 remove unused 2006-09-25 06:52:46 +00:00
Glenn Maynard 0d05ebd9b5 always leave iReturnValues on the stack, even on error, so error handling can just log the error and continue as if nil was actually returned 2006-09-23 02:44:35 +00:00
Glenn Maynard 59e1be60e6 simplify RunExpressionX. Don't check for function returns;
it's confusing to do it inconsistently.  Now, this code
path looks like the theme metric one.
2006-09-23 02:11:54 +00:00
Glenn Maynard 13f33de79a allow passing sName for expressions 2006-09-23 02:09:58 +00:00
Glenn Maynard 494c3cd485 LuaHelpers::RunExpression 2006-09-22 18:53:39 +00:00
Glenn Maynard 709a790f1c change arg order 2006-09-22 08:48:49 +00:00
Glenn Maynard f29762c59e change arg order 2006-09-22 08:38:30 +00:00
Glenn Maynard 557563e81d cleanup 2006-09-22 08:33:20 +00:00
Steve Checkoway 6ad2454400 Cleanup. 2006-09-21 07:25:38 +00:00
Steve Checkoway 175ae8cac4 I ended up not using this. 2006-09-21 07:19:13 +00:00
Steve Checkoway 93a5184cfd Simplify. Now FromStack() is unused except for Pop(). 2006-09-21 07:12:49 +00:00
Steve Checkoway d7e64dc979 Simplify. PushStack was only calling Push and possibly generating a function for each enumerated type which in the end only called Push. Rename PopStack -> Pop to be symmetric with Push. 2006-09-21 07:06:18 +00:00
Steve Checkoway 064f147f84 Unneeded. 2006-09-21 06:52:39 +00:00
Glenn Maynard 1749779ca8 merge ResetState into ctor 2006-09-20 23:47:08 +00:00
Glenn Maynard 494523f741 make RegisterTypes public 2006-09-20 23:31:54 +00:00
Steve Checkoway a7487918b1 Helper for simple lua function calls. 2006-08-18 00:04:08 +00:00
Steve Checkoway 6d653c7047 GetLuaInformation() returns nodes containing the registered global lua functions, classes with their associated methods, constants, and singletons. 2006-08-08 07:43:12 +00:00
Glenn Maynard 21cd26308e remove unused 2006-08-02 04:50:29 +00:00
Chris Danford 7f821e8cfc CString -> RString 2006-01-22 01:00:06 +00:00
Glenn Maynard 029f9343f6 revert 2006-01-14 18:02:54 +00:00
Jason Felds fb8dfc6309 Use proper relative paths to include the headers. 2006-01-14 17:59:19 +00:00
Glenn Maynard 476a0990ff SetGlobal(float) 2005-11-29 05:24:48 +00:00
Chris Danford 32286d12e6 add <Param /> child of a node for setting Lua globals while loading a node 2005-07-22 19:57:42 +00:00
Glenn Maynard 72e7a4b1e4 cleanup 2005-06-20 04:32:24 +00:00
Glenn Maynard bcbae8d01f private L 2005-06-16 22:27:11 +00:00
Glenn Maynard b974b1bdd4 LuaHelpers::PrepareExpression 2005-06-16 22:22:37 +00:00
Glenn Maynard 9a50b17b9d LuaHelpers::RunAtExpressionS
LuaManager::ResetState, LuaHelpers::RunScriptFile locking
2005-06-16 22:17:45 +00:00
Glenn Maynard d48bce4b66 remove unused 2005-06-16 06:44:50 +00:00
Glenn Maynard dd3b227562 LuaHelpers::RunExpressionI, LuaHelpers::RunExpressionS 2005-06-16 06:37:45 +00:00
Glenn Maynard cb3f10aabb LuaHelpers::RunExpressionF 2005-06-16 06:30:33 +00:00
Glenn Maynard 6a8940d5a4 LuaHelpers::RunExpressionB 2005-06-16 06:23:59 +00:00
Glenn Maynard 914acb4b7b LuaHelpers::RunScript 2005-06-16 06:17:32 +00:00
Glenn Maynard b93399da8c LuaHelpers::RunScriptFile 2005-06-16 06:10:50 +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 dd138bfbc2 remove unnecessary 2005-06-16 05:46:37 +00:00