1
0
Fork 0
Commit Graph

138 Commits

Author SHA1 Message Date
Mattes D 1f75d45222 Added cLuaState::cCallback for representing (resettable) Lua callbacks. 2016-06-27 20:51:48 +02:00
Mattes D fbe9866524 Bindings: Add a const-ptr variant to all stack getter functions 2016-06-05 17:20:50 +02:00
Mattes D 5618e453e6 LuaState: Inter-plugin calls now support simple tables. (#3220) 2016-05-31 00:01:55 +01:00
Mattes D e3d34d9917 Revert "Lua callback" 2016-03-21 09:58:15 +01:00
Mattes D af200dfaae Changed cLuaWindow callbacks to use cLuaState::cCallback. 2016-03-17 19:29:03 +01:00
Mattes D eb044e140e Changed plugin hook registrations to use cLuaState::cCallback. 2016-03-17 19:29:01 +01:00
Mattes D 3aa7656823 Added cLuaState::cCallback for representing (resettable) Lua callbacks. 2016-03-17 19:29:00 +01:00
LogicParrot ca6ef58b1e Bulk clearing of whitespace 2016-02-05 23:50:18 +02:00
Mattes D 122d824a8a Added a Json parser and serializer to Lua API. 2015-12-24 14:00:31 +01:00
Lukas Pioch 50a908fdc9 Fixes for clang-3.7 2015-12-19 22:43:37 +01:00
Mattes D 086c8b1834 Revised the explosion-related Lua API and docs.
Fixes #2746.
2015-12-18 12:40:34 +01:00
Mattes D b8fbba5eb9 Added PieceStructures generator. 2015-12-01 10:35:07 +01:00
Mattes D 1c8e60f91a Added LuaState tracker and memory stats logging. 2015-09-28 21:30:31 +02:00
Mattes D 5614056640 Made Lua API check strings strictly.
Previously nil was accepted as a string in cLuaState::CheckParamString(), now it's reported as an error.
2015-09-28 14:53:50 +02:00
Mattes D ad57ce5f99 Extended and fixed the cFile API. 2015-09-26 22:54:18 +02:00
Lukas Pioch e56aa4032d Maked it compileable for clang-3.7 2015-09-25 17:09:19 +02:00
Tiger Wang 5751ba0c1c Use container-based infrastructure for Travis 2015-08-20 16:15:55 +01:00
Samuel Barney 804805d35a Silenced and fixed many warning messages across multiple files. 2015-07-29 09:49:30 -06:00
Mattes D e06dd8f20e Added basic support for loading village prefabs from files. 2015-06-20 15:37:41 +02:00
Mattes D c6012a95bd LuaState: Added support for config-style usage.
Globals and table values can be queried from the Lua state easily.
Use perfect forwarding.
2015-06-17 17:13:45 +02:00
tycho 480052c058 Added LuaState support for all integral types
All so added error handling for out of range values
2015-05-19 17:09:05 +01:00
Mattes D 1240c76cb4 Lua: Break into ZBS debugger on API errors. 2015-05-16 16:19:18 +02:00
Mattes D 15771e4759 Moved cWorld manual bindings out into a separate file. 2015-05-13 11:30:57 +02:00
Mattes D 4b97569b3a ToLua now generates cLuaState::Push() and GetStackValue()
For classes exported through ToLua it generates the cLuaState::Push() and cLuaState::GetStackValue() functions, as well as the supporting forward declarations and typedefs.
Renamed virtual_method_hooks.lua to BindingsProcessor.lua since it no longer provides virtual method hooks and instead does additional processing when generating the bindings.
2015-05-12 09:20:54 +02:00
Mattes D dd10ffb63a OnExecuteCommand hook can override the command result (crXXX). 2015-05-10 23:11:30 +02:00
Tiger Wang 9c490293b8 Merge remote-tracking branch 'origin/master' into warnings
Conflicts:
	src/Mobs/Monster.cpp
	src/Vector3.h
2015-05-10 12:16:20 +01:00
Mattes D c13b1931ff More style checking.
Spaces around some operators are checked.
2015-05-09 12:58:54 +02:00
Tiger Wang 218010cd96 Fixed some Visual Studio warnings 2015-05-08 23:32:02 +01:00
Mattes D fee690a3d1 Fixed inter-plugin calls.
When an inter-plugin call failed due to function not found, the server would maul the LuaState and "yield".
Fixes #1959.
2015-05-07 23:03:04 +02:00
tycho 448df85e56 Added support for additional data in the ParticleEffect Packet
Also started refactoring how broadcasts are handled
2015-05-07 03:47:46 +01:00
Mattes D fc95501f68 Added cBlockArea:GetNonAirCropRelCoords() API function.
Fixes #1915.
2015-04-29 15:14:22 +02:00
Mattes D a89d5f53fd Refactored ManualBindings' callbacks using templates.
This is a bit easier to read, has better error reporting and fixes a few subtle bugs.
Fixes #1889.
2015-04-23 22:20:31 +02:00
Mattes D 08624348f4 Implemented cPluginManager:DoWithPlugin(), fixed ForEachPlugin().
Both functions are exported as static.
2015-04-23 19:41:01 +02:00
Mattes D 9c5162041e cNetwork: Added UDP API. 2015-02-20 14:28:05 +01:00
Mattes D 16636ff6e2 LuaAPI: Added client TLS support for TCP links. 2015-02-12 20:05:55 +01:00
Mattes D 014b96adb3 Exported cServerHandle and cNetwork:Listen to Lua.
Also added an example to the NetworkTest plugin.
2015-02-04 08:40:52 +01:00
Mattes D 360c632e36 cNetwork: Exported the Connect() method and cTCPLink class to Lua. 2015-02-04 08:40:50 +01:00
Mattes D e211aafaa4 Fixed type-conversion warnings. 2015-01-18 11:02:17 +01:00
Tycho 2a9664d6ca Initial convertion of a_Dt to std::chrono
also refactored cWorld::m_WorldAge and cWorld::m_TimeOfDay
2015-01-11 21:12:26 +00:00
Tiger Wang a26541a7c3 En masse NULL -> nullptr replace 2014-10-22 20:12:49 -07:00
Mattes D 7ed27c6b80 LuaState: Projectiles are pushed using their full class. 2014-10-22 16:06:32 +02:00
Mattes D dc4185fb86 cLuaState: cEntity is pushed with specific type. 2014-10-21 12:43:06 +02:00
Mattes D b78078a3a6 Fixed a potential crash in cEntity bindings. 2014-10-20 17:32:09 +02:00
Mattes D d50bbf3899 cLuaState: cMonster descendants don't push their specific type.
The individual mob types aren't exported to Lua, so pushing them would crash the server.
2014-10-19 12:49:54 +02:00
Mattes D b0a59927fb cLuaState: cBlockEntity descendants are pushed with proper class type. 2014-10-19 12:46:25 +02:00
Mattes D ebd31ff132 LuaState: Pushing a cEntity pushes the correct class name.
This makes Lua scripts easier, as they don't need to cast values from cEntity to the specific descendant.
2014-10-19 11:46:38 +02:00
madmaxoft 4e82a58060 Fixed crash in ForEachEntityInBox API.
Fixes #1511.
2014-10-06 13:48:44 +02:00
madmaxoft 014a55a15a LuaState: Fixed class value-getting off the stack. 2014-09-03 23:05:22 +02:00
madmaxoft a51c1e0b73 Added cWorld::ForEachEntityInBox() 2014-09-03 17:00:26 +02:00
Mattes D 51df169ad5 cLuaState: Fixed Vector3<> names pushed to Lua. 2014-08-22 10:33:15 +02:00
madmaxoft 00c524519e Fixed style: spaces after commas. 2014-07-19 14:53:41 +02:00
madmaxoft 2423fbf2ef Normalized comments.
This was mostly done automatically and then visually inspected for obvious errors.
All //-style comments should have a 2-space separation from the code, and 1 space after the comment sign.
2014-07-17 22:15:34 +02:00
madmaxoft 2dbed03cbc Changed OnWeatherChanging hook to always read the returned weather.
Ref.: http://forum.mc-server.org/showthread.php?tid=1512
2014-07-03 17:49:21 +02:00
madmaxoft d92520016d Fixed OnProjectileHitBlock bindings.
Also sorted the various cLuaState::Push() functions.
2014-06-03 19:29:23 +02:00
Tycho b449ad8613 Merge branch 'MacFixes'
Conflicts:
	src/DeadlockDetect.cpp
	src/World.cpp
2014-04-02 06:54:57 -07:00
STRWarrior a6ef40cb6e Fixed error when the hook gets called. 2014-03-29 15:43:03 +01:00
Samuel Barney eb3cc729d4 More fixes to get it to compile for me on Mac 10.9. Mostly just newline additions, but some of the unused variables were causing errors, so I wrapped them in #ifndef __APPLE__ calls, since I didn't know if they were going to be used in the future.
Also had to undefine TOLUA_TEMPLATE_BIND a couple of times.
2014-03-25 11:15:05 -06:00
madmaxoft 964647a900 Made pushing plain pointer to Lua a valid operation, with a warning.
This is used for exotic explosions, and the NORETURNDEBUG macro caused MSVC warnings across the entire cLuaState class (MSVC marked ALL Push() function overloads as non-returning)
2014-03-20 09:16:47 +01:00
madmaxoft 74b7f51b89 Errors in Lua don't include the error handler in the stack trace.
Fixes #817.
2014-03-19 22:55:47 +01:00
Tycho d904e89712 Merge branch 'Werror' into warnings
Conflicts:
	src/Globals.h
2014-03-12 10:12:13 -07:00
madmaxoft 5d7df54e35 Fixed Lua string return values.
Fixes #773.
2014-03-12 14:11:28 +01:00
madmaxoft 0c15fdf7b0 Moved Lua API registering into a separate function.
This will allow us to use Lua as lite-config files as well, should we want to.
2014-03-12 13:05:28 +01:00
Tycho 16b27c4b7a Fixed a load of format string errors 2014-03-11 14:16:08 -07:00
Tycho b480148116 Fixed warnings 2014-03-07 10:26:07 -08:00
madmaxoft ecfe17b096 cLuaState: Made public the GetStackValue() functions. 2014-03-04 21:55:24 +01:00
andrew 68b75f7b7a Manually exported g_Block tables 2014-03-02 11:12:29 +02:00
madmaxoft aaddc98b46 Attempted fix for several GCC warnings. 2014-02-26 21:37:38 +01:00
madmaxoft 865ae82114 Add Lua plugin path to package.path and .cpath.
Fixes #693.
2014-02-17 23:12:46 +01:00
madmaxoft 33c84aaa4d Added cLuaState::CheckParamFunctionOrNil().
Also fixed error reporting for the two function-checking functions.
2014-02-11 15:03:35 +01:00
madmaxoft b41bb3bb44 Fixed nested plugin function calls. 2014-02-11 08:52:14 +01:00
madmaxoft 589a4839df cLuaState: Stack traces don't include ghost 0-th element. 2014-02-10 22:44:56 +01:00
madmaxoft 310a25c456 cLuaState::cRef can be unbound and re-bound.
This will allow us to store Lua references as member variables in classes and initialize those later than in the constructor.
2014-02-09 18:39:22 +01:00
madmaxoft 010e64be11 Removed a useless check in cLuaState. 2014-02-04 22:24:03 +01:00
madmaxoft 3dc1452790 Fixed calling plugins with userdata params. 2014-02-04 14:26:36 +01:00
madmaxoft 1dbfd7eb76 Removed a leftover debug message. 2014-02-04 11:37:34 +01:00
madmaxoft 69c85e5169 Fixed error handling in cPluginManager:CallPlugin() API.
Fixed: When the called function malfunctioned, the entire plugin's call was aborted.
2014-02-04 10:29:10 +01:00
madmaxoft aa19f4fd04 Improved error resistance in cPluginManager:CallPlugin().
Fixed: If the call failed, all the next plugin calls would fail as well.
2014-02-04 09:18:32 +01:00
madmaxoft b61a74d6a2 Lua: Fixed an error in table-functions callbacks. 2014-01-29 22:56:38 +01:00
madmaxoft 2a018cfa49 Implemented cPluginManager:CallPlugin() API.
This function supersedes cPlugin:Call(), is safer to use in regards to multithreading and once again removes the need for the cPlugin class being exported at all.
2014-01-21 23:00:35 +01:00
madmaxoft 4a01879911 cLuaState can now check function params. 2014-01-19 23:45:26 +01:00
madmaxoft 332c1c59eb cCreeper is no longer available in API.
Has been replaced by cMonster.
2014-01-13 17:25:16 +01:00
madmaxoft 023ba17688 Lua errors display stack trace.
Fixes #418.
2014-01-11 23:10:40 +01:00
madmaxoft b2b7e45757 Removed internal methods from public cLuaState interface.
PushFunction(), CallFunction() and GetReturn() are not to be called independently, but rather only by using the Call() templated overrides.
Push() needs to be left in the public part, it is used for pushing results in the ManualBindings.

Preparation for #418.
2014-01-11 22:51:10 +01:00
madmaxoft bcd41dc1aa LuaState can push strings with embedded NULs.
This also marginally improves performance, since a strlen() isn't called (inside lua_pushstring()), the string length is stored in the AString object directly.
2014-01-07 17:07:48 +01:00
STRWarrior 020a8b457d implemented the recommendations Xoft gave. 2013-12-31 14:53:10 +01:00
madmaxoft 1cf6502be2 Made cmake compilation possible on Windows. 2013-12-27 11:51:08 +01:00
madmaxoft 4608beb3c6 Fixed tolua++ compilation.
Duplicate files, wrong includes, const-incorrect code...
2013-12-08 18:24:56 +01:00
madmaxoft 044fd237b6 Moved bindings-related to a Bindings subfolder.
Ref.: #407
2013-12-08 12:17:54 +01:00