Glenn Maynard
3ddbf641ac
fix some error messages
2006-10-14 02:27:49 +00:00
Glenn Maynard
61ba92a933
bind Warn
2006-10-14 02:26:33 +00:00
Glenn Maynard
651c7ca15e
simplify; use luaL_loadbuffer
2006-10-13 20:41:33 +00:00
Glenn Maynard
52edd053bd
enable debug library
2006-10-09 07:28:01 +00:00
Glenn Maynard
d0ab27b056
simplify
2006-10-09 05:43:24 +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
c72ae3bad7
use luaL_pushtype
2006-10-06 01:15:31 +00:00
Glenn Maynard
76dea048fc
__type
2006-10-06 01:07:53 +00:00
Glenn Maynard
c2a88f95cc
fix enums
2006-10-06 00:46:46 +00:00
Glenn Maynard
6431aee91c
missed: simplify
2006-10-05 20:04:14 +00:00
Glenn Maynard
47a1ab39bd
add LuaHelpers::PushValueFunc
2006-10-05 19:57:07 +00:00
Steve Checkoway
01fb4540f3
Simplify.
2006-10-01 14:51:50 +00:00
Steve Checkoway
2f2b286b45
Use quotes around string constants and enum values since they are strings in lua.
2006-10-01 07:35:59 +00:00
Glenn Maynard
2c5ed2c7a1
FromStack(string): clear the string on nil
2006-09-29 21:20:33 +00:00
Glenn Maynard
728f2d32b7
fixes/updates: both tables and userdata can be instances of a class;
...
binding changes
2006-09-29 21:18:50 +00:00
Glenn Maynard
f759525a80
simplify
2006-09-29 20:35:14 +00:00
Glenn Maynard
9424643277
simplify
2006-09-29 20:34:18 +00:00
Glenn Maynard
e501a5a9cd
move color() into RageTypes
2006-09-29 10:04:36 +00:00
Glenn Maynard
e91a806b37
remove LuaFunctions.h
2006-09-29 09:54:50 +00:00
Steve Checkoway
19b88841a3
Bah. This is really two commits. I thought I already did the first and I'm too tired to try to separate them (I wrote a long commit message explaining the first one already.)
...
1. When iterating over the tables using lua_next(), using lua_tolstring() can modify the key which confuses lua_next(). Instead push the value onto the top of the stack and Pop() the string from there.
2. Handle integer, string, and float constants. Handle the enum values by looking for FooIndex and then reading the global table Foo.
Stylesheet updating coming later this week.
2006-09-26 10:33:32 +00:00
Glenn Maynard
f567a0fd28
cleanup arg order
2006-09-26 08:54:54 +00:00
Steve Checkoway
c56d379860
Stop uglifying the ternary operator.
2006-09-26 05:44:44 +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
44170f9fb3
don't leave the file open while we execute a script (leaves the file locked in Windows while/if the dialog comes up)
2006-09-26 00:22:09 +00:00
Glenn Maynard
1ba714a7a0
use lua_tointeger
2006-09-25 08:46:18 +00:00
Glenn Maynard
486c22a405
make lua strings -> RString 8-bit clean
2006-09-25 08:33:01 +00:00
Glenn Maynard
040d96de70
not built as libraries
2006-09-25 07:37:47 +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
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
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
6c398cf49d
color(): return a table instead of four values
2006-09-22 02:14:34 +00:00
Glenn Maynard
591ef06969
use LuaReference::SetFromExpression
2006-09-22 02:08:00 +00:00
Steve Checkoway
1598deda7f
Fix crash if lua_tostring() returns NULL.
2006-09-21 09:42:08 +00:00
Steve Checkoway
3943ba773c
Fix crash if lua_tostring() returns NULL. (Maybe not accepting NULL in RString wasn't a good idea.)
2006-09-21 07:33:51 +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
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
a70080c094
Static.
2006-09-21 06:52:13 +00:00
Steve Checkoway
2e927c3636
Simplify.
2006-09-21 01:51:27 +00:00
Glenn Maynard
fe06c2e7fb
simplify
...
don't BeforeResetAll, AfterResetAll
2006-09-20 23:56:11 +00:00
Glenn Maynard
5a5d9b655e
don't need to lock in the ctor
2006-09-20 23:54:25 +00:00
Glenn Maynard
1749779ca8
merge ResetState into ctor
2006-09-20 23:47:08 +00:00
Steve Checkoway
6ea2a41b00
Cleanup RageException::Throw(). Do not use ssprintf() inside of Throw() and do not pass it bare error messages. Use RageException::Throw( "%s", sError.c_str() ); instead. Be consistent with quoting file names "%s" and theme metrics as "%s : %s". Try to make them complete English sentences when possible.
2006-09-17 01:19:19 +00:00