ScarPunk Posted August 12, 2018 Share Posted August 12, 2018 Hello every one i am trying too convert c++ classes to lua but i need tolua++ i already search for it on internet but all links are dead ;( Quote ART CODE SOUND Link to comment Share on other sites More sharing options...
Josh Posted August 13, 2018 Share Posted August 13, 2018 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
mdgunn Posted August 13, 2018 Share Posted August 13, 2018 Trying to download generates an error. <Error> <Code>SignatureDoesNotMatch</Code> <Message> The request signature we calculated does not match the signature you provided. Check your key and signing method. </Message> <AWSAccessKeyId>AKIAIRI2QHILYHOWCIEA</AWSAccessKeyId> <StringToSign> AWS4-HMAC-SHA256 20180813T082032Z 20180813/us-east-2/s3/aws4_request f4c3e165ee25c27d798e03c7825e9b536aefcde05083600828a513175ed5170e </StringToSign> <SignatureProvided> c746ca6e3e49ec2fc0913d91e61fa4def374a59eab035594cd00c512cf58468e </SignatureProvided> <StringToSignBytes> 41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 0a 32 30 31 38 30 38 31 33 54 30 38 32 30 33 32 5a 0a 32 30 31 38 30 38 31 33 2f 75 73 2d 65 61 73 74 2d 32 2f 73 33 2f 61 77 73 34 5f 72 65 71 75 65 73 74 0a 66 34 63 33 65 31 36 35 65 65 32 35 63 32 37 64 37 39 38 65 30 33 63 37 38 32 35 65 39 62 35 33 36 61 65 66 63 64 65 30 35 30 38 33 36 30 30 38 32 38 61 35 31 33 31 37 35 65 64 35 31 37 30 65 </StringToSignBytes> <CanonicalRequest> GET /leadwerksstorage/monthly_01_2017/tolua%20%20.zip.a4f89778b65aae2f8c8d170cca36d27c X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAIRI2QHILYHOWCIEA%2F20180813%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Date=20180813T082032Z&X-Amz-Expires=1200&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%2A%3DUTF-8%27%27tolua%252B%252B.zip&response-content-type=application%2Fzip%3Bcharset%3DUTF-8 host:s3.us-east-2.amazonaws.com host UNSIGNED-PAYLOAD </CanonicalRequest> <CanonicalRequestBytes> 47 45 54 0a 2f 6c 65 61 64 77 65 72 6b 73 73 74 6f 72 61 67 65 2f 6d 6f 6e 74 68 6c 79 5f 30 31 5f 32 30 31 37 2f 74 6f 6c 75 61 25 32 30 25 32 30 2e 7a 69 70 2e 61 34 66 38 39 37 37 38 62 36 35 61 61 65 32 66 38 63 38 64 31 37 30 63 63 61 33 36 64 32 37 63 0a 58 2d 41 6d 7a 2d 41 6c 67 6f 72 69 74 68 6d 3d 41 57 53 34 2d 48 4d 41 43 2d 53 48 41 32 35 36 26 58 2d 41 6d 7a 2d 43 6f 6e 74 65 6e 74 2d 53 68 61 32 35 36 3d 55 4e 53 49 47 4e 45 44 2d 50 41 59 4c 4f 41 44 26 58 2d 41 6d 7a 2d 43 72 65 64 65 6e 74 69 61 6c 3d 41 4b 49 41 49 52 49 32 51 48 49 4c 59 48 4f 57 43 49 45 41 25 32 46 32 30 31 38 30 38 31 33 25 32 46 75 73 2d 65 61 73 74 2d 32 25 32 46 73 33 25 32 46 61 77 73 34 5f 72 65 71 75 65 73 74 26 58 2d 41 6d 7a 2d 44 61 74 65 3d 32 30 31 38 30 38 31 33 54 30 38 32 30 33 32 5a 26 58 2d 41 6d 7a 2d 45 78 70 69 72 65 73 3d 31 32 30 30 26 58 2d 41 6d 7a 2d 53 69 67 6e 65 64 48 65 61 64 65 72 73 3d 68 6f 73 74 26 72 65 73 70 6f 6e 73 65 2d 63 6f 6e 74 65 6e 74 2d 64 69 73 70 6f 73 69 74 69 6f 6e 3d 61 74 74 61 63 68 6d 65 6e 74 25 33 42 25 32 30 66 69 6c 65 6e 61 6d 65 25 32 41 25 33 44 55 54 46 2d 38 25 32 37 25 32 37 74 6f 6c 75 61 25 32 35 32 42 25 32 35 32 42 2e 7a 69 70 26 72 65 73 70 6f 6e 73 65 2d 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3d 61 70 70 6c 69 63 61 74 69 6f 6e 25 32 46 7a 69 70 25 33 42 63 68 61 72 73 65 74 25 33 44 55 54 46 2d 38 0a 68 6f 73 74 3a 73 33 2e 75 73 2d 65 61 73 74 2d 32 2e 61 6d 61 7a 6f 6e 61 77 73 2e 63 6f 6d 0a 0a 68 6f 73 74 0a 55 4e 53 49 47 4e 45 44 2d 50 41 59 4c 4f 41 44 </CanonicalRequestBytes> <RequestId>A7A96404F58D6C89</RequestId> <HostId> Hd0gr5WqoOV/bPOIBrzjsZYWUZhvqT7YDwsFk+auc6p5D7u2v1/oc6BSR8mfJxGjlLhniW2KQiU= </HostId> </Error> 1 Quote Link to comment Share on other sites More sharing options...
ScarPunk Posted August 13, 2018 Author Share Posted August 13, 2018 2 hours ago, Josh said: I already saw but link is dead Quote ART CODE SOUND Link to comment Share on other sites More sharing options...
Josh Posted August 13, 2018 Share Posted August 13, 2018 53 minutes ago, ScarPunk said: I already saw but link is dead Strange. I will upload it again for you. 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ScarPunk Posted August 13, 2018 Author Share Posted August 13, 2018 Just now, Josh said: Strange. I will upload it again for you. Thanks ? Quote ART CODE SOUND Link to comment Share on other sites More sharing options...
Josh Posted August 13, 2018 Share Posted August 13, 2018 Download link is updated: https://www.leadwerks.com/community/applications/core/interface/file/attachment.php?id=12482 2 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ScarPunk Posted August 13, 2018 Author Share Posted August 13, 2018 When i launch genpkg i have an error C:\Users\Chris\Documents\Leadwerks\Projects\Millecenttreize\Source\Functions>genpkg Possible error in file "C:/Users/Chris/Documents/Leadwerks/Projects/Millecenttreize/Source/Functions\luaCallC++.h". No class found. but in my code there is a class weird ? C++ header #pragma once #include "Leadwerks.h" using namespace Leadwerks; class hello //lua { public: hello(); //lua void SayHello(); //lua }; C++ source #include "luaCallC++.h" hello::hello(){} void hello::SayHello() { System:Print("Hello ! \n i was call by lua code"); } Then i did this command C:\Users\Chris\Documents\Leadwerks\Projects\Millecenttreize\Source\Functions> tolua++ -H L_luaCallC++ luaCallC++.h and i got that: /* ** Lua binding: luaCallC++ ** Generated automatically by tolua++-1.0.92 on 08/13/18 22:01:48. */ #ifndef __cplusplus #include "stdlib.h" #endif #include "string.h" #include "tolua++.h" /* Exported function */ TOLUA_API int tolua_luaCallC++_open (lua_State* tolua_S); #include "luaCallC++.h" /* function to register type */ static void tolua_reg_types (lua_State* tolua_S) { } /* Open function */ TOLUA_API int tolua_luaCallC++_open (lua_State* tolua_S) { tolua_open(tolua_S); tolua_reg_types(tolua_S); tolua_module(tolua_S,NULL,0); tolua_beginmodule(tolua_S,NULL); tolua_endmodule(tolua_S); return 1; } #if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501 TOLUA_API int luaopen_luaCallC++ (lua_State* tolua_S) { return tolua_luaCallC++_open(tolua_S); }; #endif So i don't no if i need to continue or fix the pkg error ? Quote ART CODE SOUND Link to comment Share on other sites More sharing options...
ScarPunk Posted August 13, 2018 Author Share Posted August 13, 2018 I fix the pkg error visual studio didn't save my code so there is no class . Quote ART CODE SOUND Link to comment Share on other sites More sharing options...
Josh Posted August 14, 2018 Share Posted August 14, 2018 genpkg will create the pkg files from your headers. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ScarPunk Posted August 14, 2018 Author Share Posted August 14, 2018 4 hours ago, Josh said: genpkg will create the pkg files from your headers. Hello ?️ Question: What i need to do with the luacommand generated ? i used tolua++ after and i got a cpp file so i made a header and i included this glue file into my project Code: Main.cpp #include "App.h" #include "Functions/LC_luaCall.h" //glue file using namespace Leadwerks; int main(int argc,const char *argv[]) { if (Interpreter::L == NULL) // lua ( Interpreter::L signify what ?) Interpreter::Reset(); tolua_luaCall_open(Interpreter::L);//end lua App application = App(); if (application.Start()) { while (application.Loop()) {}; } } Problem: When i am creating an object in lua from my c++ code the program crash ! Quote ART CODE SOUND Link to comment Share on other sites More sharing options...
Josh Posted August 14, 2018 Share Posted August 14, 2018 That should be it. Try running the program with the visual studio debugger and see what happens. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ScarPunk Posted August 14, 2018 Author Share Posted August 14, 2018 7 minutes ago, Josh said: That should be it. Try running the program with the visual studio debugger and see what happens. I got that Millecenttreize.debug.exe' (Win32) : Chargé 'C:\Windows\SysWOW64\dcomp.dll'. Impossible de trouver ou d'ouvrir le fichier PDB. Le thread 0xe48 s'est arrêté avec le code 1 (0x1). Le thread 0x2a8c s'est arrêté avec le code 1 (0x1). Le thread 0x1540 s'est arrêté avec le code 1 (0x1). Le thread 0x2be8 s'est arrêté avec le code 1 (0x1). Le thread 0x46f4 s'est arrêté avec le code 1 (0x1). Le thread 0x3b48 s'est arrêté avec le code 1 (0x1). Le thread 0x27b0 s'est arrêté avec le code 1 (0x1). Le thread 0x1ef4 s'est arrêté avec le code 1 (0x1). Le thread 0x2fd4 s'est arrêté avec le code 1 (0x1). Le thread 0x2920 s'est arrêté avec le code 1 (0x1). Le thread 0x4380 s'est arrêté avec le code 1 (0x1). Le thread 0xacc s'est arrêté avec le code 1 (0x1). Le thread 0x1df8 s'est arrêté avec le code 1 (0x1). Le thread 0x33fc s'est arrêté avec le code 1 (0x1). Detected memory leaks! Dumping objects -> {536} normal block at 0x129FCA58, 316 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {530} normal block at 0x128C30F0, 496 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {529} normal block at 0x1292AD88, 240 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {515} normal block at 0x129150C0, 1504 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {509} normal block at 0x128EB4D8, 2296 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {508} normal block at 0x129283B0, 1040 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {488} normal block at 0x129FC8F0, 316 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {482} normal block at 0x128C3318, 496 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {481} normal block at 0x0E329970, 240 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {433} normal block at 0x12839BF8, 304 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {427} normal block at 0x128C2EC8, 496 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {426} normal block at 0x0E32AAC8, 240 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {412} normal block at 0x128B64D8, 2272 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {406} normal block at 0x128B52F8, 4528 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {405} normal block at 0x128B1938, 2032 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {380} normal block at 0x1289D420, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {379} normal block at 0x1289C1E0, 4624 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {368} normal block at 0x128973B8, 7984 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {367} normal block at 0x1288BBA0, 3568 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {213} normal block at 0x127F7C28, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {212} normal block at 0x127EBB98, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {206} normal block at 0x127F3BF8, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {205} normal block at 0x127EFBC8, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {193} normal block at 0x127D6700, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {190} normal block at 0x122CE5C0, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {189} normal block at 0x122CA590, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {188} normal block at 0x122C6560, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {186} normal block at 0x122C2530, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {185} normal block at 0x122BE500, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {184} normal block at 0x122BA4D0, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {183} normal block at 0x122B2420, 32896 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {182} normal block at 0x122A2370, 65664 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {181} normal block at 0x1229A2C0, 32896 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {180} normal block at 0x12292210, 32896 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {179} normal block at 0x1228A160, 32896 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {178} normal block at 0x12281F30, 33280 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {177} normal block at 0x12269EC0, 98368 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {171} normal block at 0x121C11D0, 8 bytes long. Data: <X % { > 58 C7 25 12 80 7B 8E 01 {165} normal block at 0x121C10F0, 8 bytes long. Data: <d % { > 64 C6 25 12 80 7B 8E 01 {164} normal block at 0x1225C5A0, 2720 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {163} normal block at 0x1225C420, 336 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {157} normal block at 0x04EF4998, 760 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {143} normal block at 0x04EF44F0, 1144 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {142} normal block at 0x078C9040, 528 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {125} normal block at 0x0E031F28, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {124} normal block at 0x0E02DEF8, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {123} normal block at 0x0E029EC8, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {122} normal block at 0x0E025E98, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {116} normal block at 0x0E021E68, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {115} normal block at 0x0E01DE38, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {114} normal block at 0x0E019E08, 16384 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {113} normal block at 0x0E011D58, 32896 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {112} normal block at 0x0E001CA8, 65664 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {111} normal block at 0x0DFF9BF8, 32896 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {110} normal block at 0x0DFF1B48, 32896 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {109} normal block at 0x078BF800, 32896 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {108} normal block at 0x0DFE9918, 33280 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {107} normal block at 0x0DFD18A8, 98368 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {101} normal block at 0x04EDA280, 8 bytes long. Data: < { > 98 E5 91 07 80 7B 8E 01 {95} normal block at 0x04EDA050, 8 bytes long. Data: < { > A4 E4 91 07 80 7B 8E 01 {94} normal block at 0x0791E3F8, 2720 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 {92} normal block at 0x078A6F60, 336 bytes long. Data: <cccccccccccccccc> 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 63 Object dump complete. Le programme '[4248] Millecenttreize.debug.exe' s'est arrêté avec le code 1 (0x1). Lua code: function Script:Start() speaker = hello:new() speaker:SayHello() end Quote ART CODE SOUND Link to comment Share on other sites More sharing options...
Josh Posted August 14, 2018 Share Posted August 14, 2018 If you are running the debugger it should stop on the line of code that crashes. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ScarPunk Posted August 14, 2018 Author Share Posted August 14, 2018 21 minutes ago, Josh said: If you are running the debugger it should stop on the line of code that crashes. I don't know it just crashing and doesn't show where it crash Console: error × Quote ART CODE SOUND Link to comment Share on other sites More sharing options...
Josh Posted August 14, 2018 Share Posted August 14, 2018 Ok, in your binding code above I don’t see anything about this hello class you are trying to add. So why is it not there? Is it in the pkg file? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ScarPunk Posted August 14, 2018 Author Share Posted August 14, 2018 4 minutes ago, Josh said: Ok, in your binding code above I don’t see anything about this hello class you are trying to add. So why is it not there? Is it in the pkg file? I don't know what to do with the pkg file $#include "Leadwerks.h" $using namespace Leadwerks; class hello { hello(); void SayHello(); }; bool import(const std::string& path); Quote ART CODE SOUND Link to comment Share on other sites More sharing options...
Josh Posted August 14, 2018 Share Posted August 14, 2018 Ah okay. You just have to indicate what pkg file to load. I do this by creating a .bat file with these contents: genpkg.exe tolua++.exe -o lua-gluecode.cpp luacommands.pkg 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ScarPunk Posted August 14, 2018 Author Share Posted August 14, 2018 2 minutes ago, Josh said: Ah okay. You just have to indicate what pkg file to load. I do this by creating a .bat file with these contents: genpkg.exe tolua++.exe -o lua-gluecode.cpp luacommands.pkg A ok i did this command tolua++ -o LC_luaCall luaCall.cpp Quote ART CODE SOUND Link to comment Share on other sites More sharing options...
Josh Posted August 14, 2018 Share Posted August 14, 2018 I think you have to specify the pkg file like I did above. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ScarPunk Posted August 14, 2018 Author Share Posted August 14, 2018 5 hours ago, Josh said: I think you have to specify the pkg file like I did above. Ok so i made a good glue code Code: source /* ** Lua binding: luacommands ** Generated automatically by tolua++-1.0.92 on 08/14/18 22:20:58. */ #ifndef __cplusplus #include "stdlib.h" #endif #include "string.h" #include "tolua++.h" #include "luaCall.h" /* Exported function */ TOLUA_API int tolua_luacommands_open (lua_State* tolua_S); #include "Leadwerks.h" using namespace Leadwerks; /* function to release collected object via destructor */ #ifdef __cplusplus static int tolua_collect_hello (lua_State* tolua_S) { hello* self = (hello*) tolua_tousertype(tolua_S,1,0); Mtolua_delete(self); return 0; } #endif /* function to register type */ static void tolua_reg_types (lua_State* tolua_S) { tolua_usertype(tolua_S,"hello"); } /* method: new of class hello */ #ifndef TOLUA_DISABLE_tolua_luacommands_hello_new00 static int tolua_luacommands_hello_new00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertable(tolua_S,1,"hello",0,&tolua_err) || !tolua_isnoobj(tolua_S,2,&tolua_err) ) goto tolua_lerror; else #endif { { hello* tolua_ret = (hello*) Mtolua_new((hello)()); tolua_pushusertype(tolua_S,(void*)tolua_ret,"hello"); } } return 1; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); return 0; #endif } #endif //#ifndef TOLUA_DISABLE /* method: new_local of class hello */ #ifndef TOLUA_DISABLE_tolua_luacommands_hello_new00_local static int tolua_luacommands_hello_new00_local(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertable(tolua_S,1,"hello",0,&tolua_err) || !tolua_isnoobj(tolua_S,2,&tolua_err) ) goto tolua_lerror; else #endif { { hello* tolua_ret = (hello*) Mtolua_new((hello)()); tolua_pushusertype(tolua_S,(void*)tolua_ret,"hello"); tolua_register_gc(tolua_S,lua_gettop(tolua_S)); } } return 1; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); return 0; #endif } #endif //#ifndef TOLUA_DISABLE /* method: SayHello of class hello */ #ifndef TOLUA_DISABLE_tolua_luacommands_hello_SayHello00 static int tolua_luacommands_hello_SayHello00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"hello",0,&tolua_err) || !tolua_isnoobj(tolua_S,2,&tolua_err) ) goto tolua_lerror; else #endif { hello* self = (hello*) tolua_tousertype(tolua_S,1,0); #ifndef TOLUA_RELEASE if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SayHello'", NULL); #endif { self->SayHello(); } } return 0; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'SayHello'.",&tolua_err); return 0; #endif } #endif //#ifndef TOLUA_DISABLE /* function: import */ #ifndef TOLUA_DISABLE_tolua_luacommands_import00 static int tolua_luacommands_import00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE tolua_Error tolua_err; if ( !tolua_iscppstring(tolua_S,1,0,&tolua_err) || !tolua_isnoobj(tolua_S,2,&tolua_err) ) goto tolua_lerror; else #endif { const std::string path = ((const std::string) tolua_tocppstring(tolua_S,1,0)); { bool tolua_ret = (bool) import(path); tolua_pushboolean(tolua_S,(bool)tolua_ret); tolua_pushcppstring(tolua_S,(const char*)path); } } return 2; #ifndef TOLUA_RELEASE tolua_lerror: tolua_error(tolua_S,"#ferror in function 'import'.",&tolua_err); return 0; #endif } #endif //#ifndef TOLUA_DISABLE /* Open function */ TOLUA_API int tolua_luacommands_open (lua_State* tolua_S) { tolua_open(tolua_S); tolua_reg_types(tolua_S); tolua_module(tolua_S,NULL,0); tolua_beginmodule(tolua_S,NULL); #ifdef __cplusplus tolua_cclass(tolua_S,"hello","hello","",tolua_collect_hello); #else tolua_cclass(tolua_S,"hello","hello","",NULL); #endif tolua_beginmodule(tolua_S,"hello"); tolua_function(tolua_S,"new",tolua_luacommands_hello_new00); tolua_function(tolua_S,"new_local",tolua_luacommands_hello_new00_local); tolua_function(tolua_S,".call",tolua_luacommands_hello_new00_local); tolua_function(tolua_S,"SayHello",tolua_luacommands_hello_SayHello00); tolua_endmodule(tolua_S); tolua_function(tolua_S,"import",tolua_luacommands_import00); tolua_endmodule(tolua_S); return 1; } #if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501 TOLUA_API int luaopen_luacommands (lua_State* tolua_S) { return tolua_luacommands_open(tolua_S); }; #endif Header /* ** Lua binding: luacommands ** Generated automatically by tolua++-1.0.92 on 08/14/18 22:20:58. */ #include "Leadwerks.h" using namespace Leadwerks; /* Exported function */ TOLUA_API int tolua_luacommands_open (lua_State* tolua_S); Problem: but now i have a new problem with lua when i am loading the map. Quote ART CODE SOUND Link to comment Share on other sites More sharing options...
Josh Posted August 15, 2018 Share Posted August 15, 2018 I think it makes the most sense to start with a simple case and call Interpreter::ExecuteFile() to execute a script that has your commands in it: speaker = hello:new() speaker:SayHello() Look at the console output and see if it prints a Lua error. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ScarPunk Posted August 15, 2018 Author Share Posted August 15, 2018 New error ;( Quote ART CODE SOUND Link to comment Share on other sites More sharing options...
Josh Posted August 15, 2018 Share Posted August 15, 2018 Upload your project here? Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
ScarPunk Posted August 15, 2018 Author Share Posted August 15, 2018 App.h luaCall.cpp luaCall.h main.cpp App.cpp luaCall.cpp glue.cpp glue.h luaCall.h luacommands.pkg Quote ART CODE SOUND Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.