diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-03-08 12:29:45 +0100 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-03-08 12:29:45 +0100 |
commit | 527f3585108111d915c2982b6be6a6adbb5ff4d9 (patch) | |
tree | 63b622d8d4840bed7c08d9afc279733d8b7e1c56 /src/Bindings | |
parent | Change TNT Fuse to ticks (diff) | |
parent | Merge pull request #764 from xdot/master (diff) | |
download | cuberite-527f3585108111d915c2982b6be6a6adbb5ff4d9.tar cuberite-527f3585108111d915c2982b6be6a6adbb5ff4d9.tar.gz cuberite-527f3585108111d915c2982b6be6a6adbb5ff4d9.tar.bz2 cuberite-527f3585108111d915c2982b6be6a6adbb5ff4d9.tar.lz cuberite-527f3585108111d915c2982b6be6a6adbb5ff4d9.tar.xz cuberite-527f3585108111d915c2982b6be6a6adbb5ff4d9.tar.zst cuberite-527f3585108111d915c2982b6be6a6adbb5ff4d9.zip |
Diffstat (limited to 'src/Bindings')
-rw-r--r-- | src/Bindings/ManualBindings.cpp | 81 |
1 files changed, 73 insertions, 8 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index b094da5fc..a5247bbe6 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -2457,7 +2457,7 @@ static int tolua_cBlockArea_GetSize(lua_State * tolua_S) static int tolua_cBlockArea_LoadFromSchematicFile(lua_State * tolua_S) { // function cBlockArea::LoadFromSchematicFile - // Exported manually because function has been moved to SchematicFileSerilizer.cpp + // Exported manually because function has been moved to SchematicFileSerializer.cpp cLuaState L(tolua_S); if ( !L.CheckParamUserType(1, "cBlockArea") || @@ -2484,10 +2484,41 @@ static int tolua_cBlockArea_LoadFromSchematicFile(lua_State * tolua_S) +static int tolua_cBlockArea_LoadFromSchematicString(lua_State * tolua_S) +{ + // function cBlockArea::LoadFromSchematicString + // Exported manually because function has been moved to SchematicFileSerializer.cpp + cLuaState L(tolua_S); + if ( + !L.CheckParamUserType(1, "cBlockArea") || + !L.CheckParamString (2) || + !L.CheckParamEnd (3) + ) + { + return 0; + } + cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, NULL); + if (self == NULL) + { + tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea::LoadFromSchematicFile'", NULL); + return 0; + } + + AString Data; + L.GetStackValue(2, Data); + bool res = cSchematicFileSerializer::LoadFromSchematicString(*self, Data); + tolua_pushboolean(tolua_S, res); + return 1; +} + + + + + static int tolua_cBlockArea_SaveToSchematicFile(lua_State * tolua_S) { // function cBlockArea::SaveToSchematicFile - // Exported manually because function has been moved to SchematicFileSerilizer.cpp + // Exported manually because function has been moved to SchematicFileSerializer.cpp cLuaState L(tolua_S); if ( !L.CheckParamUserType(1, "cBlockArea") || @@ -2513,6 +2544,38 @@ static int tolua_cBlockArea_SaveToSchematicFile(lua_State * tolua_S) +static int tolua_cBlockArea_SaveToSchematicString(lua_State * tolua_S) +{ + // function cBlockArea::SaveToSchematicString + // Exported manually because function has been moved to SchematicFileSerializer.cpp + cLuaState L(tolua_S); + if ( + !L.CheckParamUserType(1, "cBlockArea") || + !L.CheckParamEnd (2) + ) + { + return 0; + } + cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, NULL); + if (self == NULL) + { + tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea::SaveToSchematicFile'", NULL); + return 0; + } + + AString Data; + if (cSchematicFileSerializer::SaveToSchematicString(*self, Data)) + { + L.Push(Data); + return 1; + } + return 0; +} + + + + + static int tolua_cCompositeChat_AddRunCommandPart(lua_State * tolua_S) { // function cCompositeChat:AddRunCommandPart(Message, Command, [Style]) @@ -2776,12 +2839,14 @@ void ManualBindings::Bind(lua_State * tolua_S) tolua_endmodule(tolua_S); tolua_beginmodule(tolua_S, "cBlockArea"); - tolua_function(tolua_S, "GetBlockTypeMeta", tolua_cBlockArea_GetBlockTypeMeta); - tolua_function(tolua_S, "GetOrigin", tolua_cBlockArea_GetOrigin); - tolua_function(tolua_S, "GetRelBlockTypeMeta", tolua_cBlockArea_GetRelBlockTypeMeta); - tolua_function(tolua_S, "GetSize", tolua_cBlockArea_GetSize); - tolua_function(tolua_S, "LoadFromSchematicFile", tolua_cBlockArea_LoadFromSchematicFile); - tolua_function(tolua_S, "SaveToSchematicFile", tolua_cBlockArea_SaveToSchematicFile); + tolua_function(tolua_S, "GetBlockTypeMeta", tolua_cBlockArea_GetBlockTypeMeta); + tolua_function(tolua_S, "GetOrigin", tolua_cBlockArea_GetOrigin); + tolua_function(tolua_S, "GetRelBlockTypeMeta", tolua_cBlockArea_GetRelBlockTypeMeta); + tolua_function(tolua_S, "GetSize", tolua_cBlockArea_GetSize); + tolua_function(tolua_S, "LoadFromSchematicFile", tolua_cBlockArea_LoadFromSchematicFile); + tolua_function(tolua_S, "LoadFromSchematicString", tolua_cBlockArea_LoadFromSchematicString); + tolua_function(tolua_S, "SaveToSchematicFile", tolua_cBlockArea_SaveToSchematicFile); + tolua_function(tolua_S, "SaveToSchematicString", tolua_cBlockArea_SaveToSchematicString); tolua_endmodule(tolua_S); tolua_beginmodule(tolua_S, "cCompositeChat"); |