Commit Graph

22708 Commits

Author SHA1 Message Date
Glenn Maynard 3eddfac7fc nil already pushed 2006-09-23 02:48:12 +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 c9045a920c use RunExpression 2006-09-23 02:25:36 +00:00
Glenn Maynard 0c2169923a cleanup 2006-09-23 02:24:23 +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 09afb81741 GetMetric pushes the metric directly. This is faster, avoiding
converting the metric to a string and then back into Lua, and
works with any type; with "Class::Metric=math.sin",
THEME:GetMetric("Class","Metric") will return the function sin().
2006-09-22 21:23:13 +00:00
Glenn Maynard 4ae6eb6070 unused functions 2006-09-22 20:53:36 +00:00
Glenn Maynard 56c12a5bb3 unneeded header 2006-09-22 20:07:35 +00:00
Glenn Maynard 3f95e889d4 use LuaHelpers::FromStack directly 2006-09-22 20:06:14 +00:00
Glenn Maynard d720b18eaa use LuaHelpers::FromStack to generalize metrics 2006-09-22 20:05:37 +00:00
Glenn Maynard 593e2af79a fix "RageColor x = 0" silently compiles and crashes 2006-09-22 19:51:51 +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 40eef3c600 cleanup 2006-09-22 19:40:32 +00:00
Glenn Maynard d55c71f5cf Don't ReplaceMarkers metrics. Only do that for language strings. 2006-09-22 19:36:17 +00:00
Glenn Maynard eb016b06d7 move into Languages 2006-09-22 19:22:06 +00:00
Glenn Maynard 16d78d5f05 type check 2006-09-22 19:08:16 +00:00
Glenn Maynard 32ccbbbb99 LuaHelpers::FromStack 2006-09-22 19:07:56 +00:00
Glenn Maynard f8b3a17c6f split out ThemeManager::PushMetric 2006-09-22 19:05:56 +00:00
Glenn Maynard 874a4fc2bb use ParseActorCommands(L) and RunExpression 2006-09-22 19:01:13 +00:00
Glenn Maynard 0ad4fcf6e2 ParseActorCommands( Lua *, sCommands ) -> onto stack 2006-09-22 18:59:26 +00:00
Glenn Maynard 6da267ae30 make compile errors for commands less fatal 2006-09-22 18:58:00 +00:00
Glenn Maynard 494c3cd485 LuaHelpers::RunExpression 2006-09-22 18:53:39 +00:00
Jason Felds a7a6d643a4 Add the *Workout* files. 2006-09-22 14:56:39 +00:00
Chris Danford 58603a48f2 add Workout files 2006-09-22 11:36:12 +00:00
Glenn Maynard d98c17eac6 move code 2006-09-22 09:52:08 +00:00
Glenn Maynard 85d8006257 remove LuaReference name; keep LuaReference lightweight 2006-09-22 09:46:31 +00:00
Glenn Maynard 8cb1c66023 remove SetName 2006-09-22 09:43:12 +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
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 1bb569f8c4 LuaReference and apActorCommands are the same thing; apActorCommands
just sticks the result in AutoPtrCopyOnWrite.  apActorCommands might be
eliminated; it's reference counting a garbage collected object.  (It
used to be more useful, when we stored actual command lists; now I'm
not sure whether it is.  Need to benchmark LuaRef copying to see.)

So, we shouldn't be treating them differently, but we are:
GetMetric(apActorCommands) parses actor commands, and GetMetric(LuaRef)
does not.  I don't like that distinction; actor commands can be passed
around as a LuaReference, and other references can be put in
apActorCommands.  "Whether it's in a smart pointer" is a strange
way to decide which overload to use.

Also, we should have a consistent way to know whether a metric is to
be parsed as a command or as a Lua expression, based on the data
itself and not the code being used to read it.  Let's use the name:
all commands end with "Command".  We already depend on this elsewhere,
in ActorUtil::LoadAllCommandsFromName.

Note that "actor commands" are not specific to the Actor system,
other than a few compatibility hacks; they're just a shorthand
for writing Lua functions.
2006-09-22 07:50:05 +00:00
Glenn Maynard 0006a92712 commands end with Command 2006-09-22 07:46:21 +00:00
Glenn Maynard 13937cf7eb bools 2006-09-22 07:21:34 +00:00
Glenn Maynard 607cf44b31 old comment 2006-09-22 07:18:37 +00:00
Glenn Maynard 305d9a86f5 remove hack; no longer necessary 2006-09-22 07:18:20 +00:00
Glenn Maynard ec69abca83 use DynamicThemeMetric 2006-09-22 07:14:56 +00:00
Glenn Maynard 09a0981eaf handle Fallback metrics like the rest 2006-09-22 07:00:26 +00:00
Steve Checkoway 930af9db5c Add file. 2006-09-22 06:58:14 +00:00
Glenn Maynard 59ad3f8222 ThemeManager::GetClassFallback 2006-09-22 06:41:27 +00:00
Jason Felds d0c97aa6ed File update (untestable: normal updater hasn't been around). 2006-09-22 05:31:21 +00:00
Glenn Maynard 7f974f428b double quotes look cleaner than single quotes 2006-09-22 05:02:27 +00:00
Glenn Maynard f8c1675309 allocate later
don't set name for binary chunks
2006-09-22 04:56:35 +00:00
Glenn Maynard 4a9b1736f5 flip GetMetric(ref) and GetMetricR(), so there's an interface exposed that doens't
copy the reference.  Copying refs isn't expensive, but it does lock Lua.
2006-09-22 04:46:47 +00:00
Glenn Maynard 6b89313b09 cleanup 2006-09-22 04:38:42 +00:00
Glenn Maynard 6d616e8a86 major format update. This was done mostly by grepping the source
for ThemeMetric<RString> and GetMetric, and then doing a runthrough;
I probably missed some.
2006-09-22 04:36:53 +00:00
Glenn Maynard f90088d616 Currently all metrics except for strings and commands are valid
Lua expressions, and commands simply allow a shorthand that generates
valid Lua expressions.  Make strings Lua expressions.

This essentially reverses strings; rather than:
  Metric1=Text
  Metric2=@Text()

specify:

  Metric1="Text"
  Metric2=Text()

This means that every metric (except Fallback, currently) can be
treated as a Lua expression, except for Command metrics that just
need a bit of preprocessing.
2006-09-22 04:35:11 +00:00