From 5c37d14e53c729c10d87849408058031d96d51f1 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Thu, 9 Oct 2014 14:14:05 +0200 Subject: backported C++ string handling from tolua++ to tolua added test for string parameter in tolua test adapted google normalizer example in crawl.conf --- tests/tolua/libtest1/TestMod.cpp | 5 +++++ tests/tolua/libtest1/TestMod.hpp | 2 ++ tests/tolua/libtest1/TestMod.pkg | 5 +++++ tests/tolua/test1.lua | 1 + 4 files changed, 13 insertions(+) (limited to 'tests') diff --git a/tests/tolua/libtest1/TestMod.cpp b/tests/tolua/libtest1/TestMod.cpp index b06644e..7e95d0f 100755 --- a/tests/tolua/libtest1/TestMod.cpp +++ b/tests/tolua/libtest1/TestMod.cpp @@ -12,6 +12,11 @@ void Derived::hello( ) cout << "hello" << endl; } +void Derived::hello( const std::string &message ) +{ + cout << message << endl; +} + static void initModule( void *user_data ) { LuaVM *luaVm = (LuaVM *)user_data; diff --git a/tests/tolua/libtest1/TestMod.hpp b/tests/tolua/libtest1/TestMod.hpp index f4886cd..c9def19 100755 --- a/tests/tolua/libtest1/TestMod.hpp +++ b/tests/tolua/libtest1/TestMod.hpp @@ -13,6 +13,8 @@ class Derived : public Base virtual ~Derived( ) { } virtual void hello( ); + + virtual void hello( const std::string &msg ); }; DECLARE_MODULE( Base ) diff --git a/tests/tolua/libtest1/TestMod.pkg b/tests/tolua/libtest1/TestMod.pkg index 4fed1d3..2bb4ebc 100644 --- a/tests/tolua/libtest1/TestMod.pkg +++ b/tests/tolua/libtest1/TestMod.pkg @@ -1,5 +1,9 @@ $#include "TestMod.hpp" +$#include + +$using namespace std; + class Derived : public Base { Derived( ) { } @@ -7,4 +11,5 @@ class Derived : public Base virtual ~Derived( ) { } virtual void hello( ); + virtual void hello( string msg ); }; diff --git a/tests/tolua/test1.lua b/tests/tolua/test1.lua index 3310825..6d30937 100644 --- a/tests/tolua/test1.lua +++ b/tests/tolua/test1.lua @@ -1,3 +1,4 @@ local b = Derived:new( ) b:hello( ) +b:hello( "Show this string" ) b:delete( ) -- cgit v1.2.3-54-g00ecf