diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_fr> | 2010-05-28 02:59:45 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_fr> | 2010-05-28 03:42:16 +0200 |
commit | 39b00578c249a3396bb03faa92bc9cccdcb1c68a (patch) | |
tree | fb9376dd3229f37c4b8d988c569493178ee130bd /src/scripting/luautil.cpp | |
parent | e6ce3d52648aec7139f1c3383a0ef0921411f0d4 (diff) | |
download | manaserv-39b00578c249a3396bb03faa92bc9cccdcb1c68a.tar.gz manaserv-39b00578c249a3396bb03faa92bc9cccdcb1c68a.tar.bz2 manaserv-39b00578c249a3396bb03faa92bc9cccdcb1c68a.tar.xz manaserv-39b00578c249a3396bb03faa92bc9cccdcb1c68a.zip |
Modified the npc_trade() lua function to permit selling the whole player inventory.
It permits to open a sell box with every items in the player inventory
as requested by Striker.
Also added different return value support to both the buy selling functions,
and made fixes where relevant.
The test.lua script will be upgraded to show examples in a next commit.
What's left to be done is to fix the inventory handling for both selling
functions. (Sigh...)
Concerns: Manasource mantis: #78, #101.
Reviewed-by: Jaxad0127
Diffstat (limited to 'src/scripting/luautil.cpp')
-rw-r--r-- | src/scripting/luautil.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/scripting/luautil.cpp b/src/scripting/luautil.cpp index 02de6adc..a3602d2a 100644 --- a/src/scripting/luautil.cpp +++ b/src/scripting/luautil.cpp @@ -34,10 +34,21 @@ void raiseScriptError(lua_State *s, const char *format, ...) vsprintf(message, format, args); va_end( args ); - LOG_WARN("Lua script error: "<<message); + LOG_WARN("Lua script error: "<< message); luaL_error(s, message); } +void raiseWarning(lua_State *s, const char *format, ...) +{ + va_list args; + va_start(args, format); + char message[1024]; + vsprintf(message, format, args); + va_end( args ); + + LOG_WARN("Lua script error: "<< message); +} + /* Functions below are unsafe, as they assume the script has passed pointers to objects which have not yet been destroyed. If the script never keeps pointers around, there will be no problem. In order to be safe, the engine |