pplux / slb Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/slb
Automatically exported from code.google.com/p/slb
Simple Lua Binder (SLB) ------------------------- SLB is an "simple-to-use" library to wrap C/C++ code and use it from lua scripts. SLB can be compiled as dynamic library, or it can be included in your project, see INSTALLATION for further instructions. The aim of SLB is to provide an easy to use library to wrap code to/from lua and extend your applications. SLB can also be used as a reflection library for C/C++, you can query all the registered classes and ask for its methods, metadata, and so on. SLB includes a multiplatform implementation of mutexes to ensure thread safety, it can be enabled or disabled or even replaced with you own implementation. Thread safety in SLB is being tested and should be considered in beta state. USING SLB --------- The best way to learn how to use SLB is looking at the examples, they are numbered in order of complexity. SLB uses its own namespace, and every piece of data SLB requires is handled by the SLB::Manager class (which follows the singleton pattern). You don't have to care about SLB's internal classes, just take care on your own classes and how they are handled by SLB. The SLB::Script class can be used as a base class to handle lua scripts, but it is not mandatory, you can still use SLB on your own lua_states, for example: // Custom SLB::SCript, a simplification to use SLB SLB::Script s; s.doString(lua_code); or, if you're creating your own lua_States then: // Create a lua State, using normal lua API lua_State *L = luaL_newstate(); // load default functions (the current example uses print) // and by default, SLB::Script does this. luaL_openlibs(L); // Register SLB inside the lua_State, calling the SLB::Manager // that handles bindings, default functions, default values... SLB::Manager::getInstance().registerSLB(L); // Now call lua API to execute the same code as above luaL_dostring(L, lua_code); // execute code Once, SLB is registered inside a lua_State, you can start using your wrapped classes. To wrap a class, you must declare its contents, for example: SLB::Class< FirstClass >("Namespace::FirstClass") // declares an empty constructor .constructor() .set("getString", &FirstClass::getString) .set("setString", &FirstClass::setString) .set("getInt", &FirstClass::getInt) .set("setInt", &FirstClass::setInt) ; This code must be executed somewhere before a script can make use of the "FirstClass" class. Classes can declare just one constructor, and overloading is not supported. The ".set" statements can be used for anything, not just methods of the class, you can use it with values, enums, c functions, and so on. By default SLB registers all classes in the same manager, the default manager.That allows any script to access all registered classes. If you need to limit a script to access just some set of C++ classes you can create managers and selectively register classes into it. To do so, you pass a pointer to your manager, as second argument of SLB::Class construction: SLB::Manager MyManager; SLB::Class< FirstClass >("Namespace::FirstClass", MyManager) .constructor() ... SLB From Lua ------------ SLB doesn't pollute the lua global namespace, it stores everything under a table called SLB. Even your classes are there, but you can populate a namespace to the global table callint "SLB.using(namespace)" from lua. For example, without the using the above our class could be instantiated from the script with: fc = SLB.Namespace.FirstClass() With the using, we can do: SLB.using(SLB.Namespace) fc = FirstClass() Once we have received/created a class we can access to its methods, but instead of the dot(.) notation in lua we use the colon(:) for example: fc:setString("a string") print(fc:getString()) More advanced use of SLB is exposed in the examples and wiki docs (under construction). INSTALLATION ------------ SLB uses premake, but it is mainly used for the SLB's development. You are encouraged to use SLB as part of your own library/program for the sake of simplicity, but it is ready to be used as a dynamic library. To include SLB as part of your own project, grab the src/ and include/ directories and compile all the .cpp/c files under src/. If SLB is going to be part of a dll on Windows , or a dll itself, then enable the macro declaration SLB_LIBRARY that will properly adjust the SLB_EXPORT macro.
cannot compile in Visual Studio 2008 In release build
What is the expected output? What do you see instead?
a built project.
This error:
slb\slb\src\lua\ltm.h(49) : error C2133: 'luaT_typenames_' : unknown size
Original issue reported on code.google.com by [email protected]
on 27 Apr 2011 at 4:00
Pretty sure it was just omitted inadvertently. Thanks!
Original issue reported on code.google.com by [email protected]
on 21 Aug 2012 at 4:06
What steps will reproduce the problem?
1. Unable to register variadic C functions using SLB::Manager
What is the expected output? What do you see instead?
Attempting to register using .set of SLB::Manager gives the gcc/g++ compile
error: invalid conversion from 'void (*)(char const*, ...)' to 'lua_CFunction
{aka int (*)(lua_State*)}' [-fpermissive]
What version of the product are you using? On what operating system?
Using SLB-2.00 on Lua 5.2.1.
Please provide any additional information below.
Doing this
void foo(char const *format, ...);
slbMgr.set("foo", SLB::FuncCall::create(foo));
gives the error
...error: invalid conversion from 'void (*)(char const*, ...)' to
'lua_CFunction {aka int (*)(lua_State*)}' [-fpermissive]
...SLB-2.00/SLB.hpp:2173:22: error: initializing argument 1 of 'static
SLB::FuncCall* SLB::FuncCall::create(lua_CFunction)' [-fpermissive]
Original issue reported on code.google.com by [email protected]
on 16 Jan 2013 at 12:48
What steps will reproduce the problem?
1. Run the script with a syntax error
2. See the description you receive with std::exception
3. Run it again
4. See the description now contains doubled description
...
N. See how description becomes extremely huge.
What version of the product are you using? On what operating system?
SLB 2.0b
Fix:
To fix you need to clear the stream and set an empty string
void DefaultErrorHandler::begin(const char *error)
{
_out.clear();
_out.str(""); //<<<<<< Add this line to fix it.
Works fine for me now.
For references see
http://stackoverflow.com/questions/624260/how-to-reuse-an-ostringstream
Original issue reported on code.google.com by [email protected]
on 25 Jan 2012 at 3:23
What steps will reproduce the problem?
1.when complie file that include luacall.hpp
2.is there any define I missed?
3.
What is the expected output? What do you see instead?
# ndk-build
Compile++ thumb : SLB <= ClassInfo.cpp
In file included from E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni
/include/SLB/Hybrid.hpp:36,
from E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni
/src/ClassInfo.cpp:31:
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:59: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:59: error: expected ';' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<R()>::operator==(const SLB::LuaCall<R(
)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<R(T1)>::operator==(const SLB::LuaCall<
R(T1)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<R(T1, T2)>::operator==(const SLB::LuaC
all<R(T1, T2)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<R(T1, T2, T3)>::operator==(const SLB::
LuaCall<R(T1, T2, T3)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<R(T1, T2, T3, T4)>::operator==(const S
LB::LuaCall<R(T1, T2, T3, T4)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<R(T1, T2, T3, T4, T5)>::operator==(con
st SLB::LuaCall<R(T1, T2, T3, T4, T5)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<R(T1, T2, T3, T4, T5, T6)>::operator==
(const SLB::LuaCall<R(T1, T2, T3, T4, T5, T6)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<R(T1, T2, T3, T4, T5, T6, T7)>::operat
or==(const SLB::LuaCall<R(T1, T2, T3, T4, T5, T6, T7)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<R(T1, T2, T3, T4, T5, T6, T7, T8)>::op
erator==(const SLB::LuaCall<R(T1, T2, T3, T4, T5, T6, T7, T8)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<R(T1, T2, T3, T4, T5, T6, T7, T8, T9)>
::operator==(const SLB::LuaCall<R(T1, T2, T3, T4, T5, T6, T7, T8, T9)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<R(T1, T2, T3, T4, T5, T6, T7, T8, T9,
T10)>::operator==(const SLB::LuaCall<R(T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)>
&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:92: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'void SLB::LuaCall<void()>::operator()(char)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: invalid conversion from 'int' to 'lua_State*'
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: initializing argument 1 of 'int lua_gettop(lua_State*)'
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: invalid conversion from 'int' to 'lua_State*'
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: initializing argument 1 of 'void lua_rawgeti(lua_State*, int, i
nt)'
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: invalid conversion from 'int' to 'lua_State*'
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: initializing argument 1 of 'void lua_settop(lua_State*, int)'
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<void()>::operator==(const SLB::LuaCall
<void()>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<void(T1)>::operator==(const SLB::LuaCa
ll<void(T1)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<void(T1, T2)>::operator==(const SLB::L
uaCall<void(T1, T2)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<void(T1, T2, T3)>::operator==(const SL
B::LuaCall<void(T1, T2, T3)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<void(T1, T2, T3, T4)>::operator==(cons
t SLB::LuaCall<void(T1, T2, T3, T4)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<void(T1, T2, T3, T4, T5)>::operator==(
const SLB::LuaCall<void(T1, T2, T3, T4, T5)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<void(T1, T2, T3, T4, T5, T6)>::operato
r==(const SLB::LuaCall<void(T1, T2, T3, T4, T5, T6)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<void(T1, T2, T3, T4, T5, T6, T7)>::ope
rator==(const SLB::LuaCall<void(T1, T2, T3, T4, T5, T6, T7)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<void(T1, T2, T3, T4, T5, T6, T7, T8)>:
:operator==(const SLB::LuaCall<void(T1, T2, T3, T4, T5, T6, T7, T8)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<void(T1, T2, T3, T4, T5, T6, T7, T8, T
9)>::operator==(const SLB::LuaCall<void(T1, T2, T3, T4, T5, T6, T7, T8, T9)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected ')' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp: In member function 'bool SLB::LuaCall<void(T1, T2, T3, T4, T5, T6, T7, T8, T
9, T10)>::operator==(const SLB::LuaCall<void(T1, T2, T3, T4, T5, T6, T7, T8, T9,
T10)>&)':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/LuaCall.h
pp:114: error: expected ')' before numeric constant
In file included from E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni
/src/ClassInfo.cpp:31:
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/Hybrid.hp
p: At global scope:
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/Hybrid.hp
p:105: error: expected unqualified-id before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/Hybrid.hp
p:105: error: expected ';' before numeric constant
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/Hybrid.hp
p: In member function 'virtual lua_State* SLB::HybridBase::getLuaState() const':
E:/android/android-ndk-r5b/samples/test-new-lua/jni/../jni/include/SLB/Hybrid.hp
p:65: error: invalid conversion from 'int' to 'lua_State*'
make: *** [/cygdrive/e/android/android-ndk-r5b/samples/test-new-lua/obj/local/ar
meabi/objs/SLB/src/ClassInfo.o] Error 1
What version of the product are you using? On what operating system?
cygwin + windowsxp32
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 9 Jun 2011 at 2:04
What steps will reproduce the problem?
1.
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 9 Jun 2011 at 1:59
What steps will reproduce the problem?
1. Compile SLB on GCC 4.6.3
What is the expected output? What do you see instead?
You get the error: "there are no arguments to 'malloc' that depend on a
template parameter, so a declaration of 'malloc' must be available (if you use
'-fpermissive', G++ will accept your code, but allowing the use of an
undeclared name is deprecated)"
What version of the product are you using? On what operating system?
Latest trunk, on Ubuntu 12.04.
Please provide any additional information below.
This is because malloc is not explicitly included from any header file. Adding
an explicit declaration to stdlib.h or cstdlib.h seems to resolve it.
Original issue reported on code.google.com by [email protected]
on 17 Feb 2013 at 4:59
Attachments:
i have a problem with a templated class and bool as its template argument. see
this class
https://gitorious.org/codingninja/baukasten/blobs/develop/src/core/include/gener
ic_state.h
which is quite simple. see the declarations at the bottom
StateInt
StateString
StateBool
where the first two work without any problems. if i try to call setValue on a
StateBool in a lua script it throws the following exception:
terminate called after throwing an instance of 'std::runtime_error'
what(): SLB Exception:
-------------------------------------------------------
Lua Error:
scripts/update_state.lua:10: Unknown class b
Traceback:
[ 0 (C) ]
[ 1 (C) ] @ setValue(method)
[ 2 (main) ] scripts/update_state.lua:10
here's the lua snippet which would work if i change the type of the variable
from StateBool to StateInt:
...
testState:setValue( false )
...
here's the definition of the binding:
https://gitorious.org/codingninja/baukasten/blobs/develop/src/core/include/lua/g
lobal.h
any ideas?
Original issue reported on code.google.com by [email protected]
on 8 Sep 2011 at 8:15
What steps will reproduce the problem?
1. Define SLB_LIBRARY
2. Build .dll
3. Build .exe that links to .dll
4. Execute .exe, get access violation prior to DllMain() inside of .dll
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
SLB 1.61, Windows XP 32bit
Please provide any additional information below.
The problem is with MutexData. It defines MutexData to be LPSCRITICAL_SECTION,
then later calls InitializeMutex() with that address. The address is supposed
to point to an allocated CRITICAL_SECTION object -- InitializeMutex() does not
allocate it, just initializes it.
I solved this by defining MutexData to be CRITICAL_SECTION, and changing the
Mutex() class to pass in "&_m" instead of "_m" to InitializeCriticalSection,
DeleteCriticalSection, EnterCriticalSection, LeaveCriticalSection, and
TryEnterCriticalSection.
Original issue reported on code.google.com by [email protected]
on 26 Jul 2010 at 9:08
What steps will reproduce the problem?
1. Press F7 to compile in Visual Studio 2008 C++
What is the expected output? What do you see instead?
1 Succeeded, 0 Errors.
0 Succeeded, 1 Errors.
What version of the product are you using? On what operating system?
Mar 24, 2009. Windows XP.
Please provide any additional information below.
Error 3 error C2491: 'SLB::Manager::_singleton' : definition of dllimport
static data member not allowed c:\luatest\luatest\slb\manager.cpp 211
Original issue reported on code.google.com by [email protected]
on 26 Mar 2010 at 12:33
With Visual studio 2010 with /W4 i got those warnings
warning C4100: 'ref' : unreferenced formal
parameter i:\..\slb\include\instance.hpp 137
warning C4100: 'p' : unreferenced formal
parameter i:\..\slb\include\allocator.hpp 109
warning C4100: 'dummyARG' : unreferenced formal
parameter i:\..\slb\include\luacall.hpp 113
warning C4100: 'L' : unreferenced formal
parameter i:\..\slb\include\script.hpp 81
warning C4100: 'L' : unreferenced formal
parameter i:\..\slb\include\script.hpp 82
Thank you for your great project!
Original issue reported on code.google.com by [email protected]
on 27 May 2011 at 4:22
What steps will reproduce the problem?
1. Declare and implement a class with SLB3
2. Call a method from this class from Lua code with too many, not enough or
parameters with unexpected types
What is the expected output? What do you see instead?
The method is called with default parameter values.
An error should be thrown, or at least the method should have a way to check
the parameters count and types.
What version of the product are you using (2.xx, 3.xx, hg rev )? On what
operating system?
SLB3, hg commit ca960f74cd93, GNU/Linux.
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 1 Apr 2013 at 10:54
Currently it looks like this:
template<class T1, class T2>
__Self &__eq( bool (*func)(T1,T2) )
{
_class->setObject__newindex( FuncCall::create(func) ); return *this;
}
Should instead be:
template<class T1, class T2>
__Self &__eq( bool (*func)(T1,T2) )
{
_class->set__eq( SLB_FuncCall::create(func) ); return *this;
}
Original issue reported on code.google.com by [email protected]
on 1 Feb 2013 at 10:48
What steps will reproduce the problem?
1. Have LLVM and clang 2.8 installed
2. use either SLB-1.63 or pull from code.google.com
3. run 'CC="clang" CXX="clang++" cmake ./ && make'
What is the expected output? What do you see instead?
(See attached build log)
What version of the product are you using? On what operating system?
I'm using Gentoo with LLVM-2.8-r2 and clang-2.8-r2.
Please provide any additional information below.
This might of course be a LLVM/Clang issue as gcc compiles slb just fine
although clang c++ status page states that "Clang currently implements all of
the ISO C++ 1998 standard (including the defects addressed in the ISO C++ 2003
standard)" [1].
[1]: http://clang.llvm.org/cxx_status.html
Original issue reported on code.google.com by [email protected]
on 8 Jan 2011 at 6:31
Attachments:
What steps will reproduce the problem?
1. Build lua, slb, and unit tests with Visual Studio 2010
2. Run tests vector and ivector scripts.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
SLB-1.70
lua 5.1.4
Visual Studio 2010
Windows 7
Please provide any additional information below.
ivector.lua results in exception due to "Unknown class in"
vector.lua will run in Release mode but causes exception in Debug mode.
Original issue reported on code.google.com by [email protected]
on 4 May 2011 at 5:21
switch to clang++ to see whether it works ... just being curious. got this
error message:
In file included from
/home/noobsaibot/projekte/cpp/baukasten/src/core/include/slb/SLB.hpp:35:
/home/noobsaibot/projekte/cpp/baukasten/src/core/include/slb/Type.hpp:75:24:
error: no member named 'check' in 'SLB::ClassInfo'
return getClass(L)->check(L, pos);
~~~~~~~~~~~ ^
/home/noobsaibot/projekte/cpp/baukasten/src/core/include/slb/Type.hpp:148:24:
error: no member named 'check' in 'SLB::ClassInfo'
return getClass(L)->check(L, pos);
~~~~~~~~~~~ ^
/home/noobsaibot/projekte/cpp/baukasten/src/core/include/slb/Type.hpp:205:24:
error: no member named 'check' in 'SLB::ClassInfo'
return getClass(L)->check(L, pos);
~~~~~~~~~~~ ^
not a deal breaker for me. just so you know ;)
Original issue reported on code.google.com by [email protected]
on 9 Sep 2011 at 6:52
What steps will reproduce the problem?
1. create a class with a const method with a const return type
2. define wrapper for the class
3. const_set("method", &Class::method)
What is the expected output? What do you see instead?
being able to call the method from lua.
What version of the product are you using? On what operating system?
cloned from hg.
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 20 Aug 2011 at 12:00
What steps will reproduce the problem?
1.Attempt to compile with xcode3
2.
3.
What is the expected output? What do you see instead?
Expect a binary however it results in a compilation error.
Trailing comma is in Table::Action
https://code.google.com/p/slb/source/browse/include/SLB3/table.h#37
What version of the product are you using (2.xx, 3.xx, hg rev )? On what
operating system?
Head OS X 10.6
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 11 Oct 2014 at 7:37
if I expose the hierarchy below, foo function fails to resolve when called from
a C object.
=======================
Lua :
b = B()
c = C()
print(b:foo()) -- works
print(c:foo()) -- doesn't work
=======================
c++:
struct A
{
const char* foo() const { return "foo"; }
};
struct B : public A
{
};
struct C: public B
{
};
SLB::Class<A>("A")
.constructor()
.set("foo", &A::foo);
SLB::Class<B>("B")
.inherits<A>()
.constructor();
SLB::Class<C>("C")
.inherits<B>()
.constructor();
Original issue reported on code.google.com by [email protected]
on 22 Oct 2011 at 7:32
I noticed some problems trying to compile the latest HG revision of SLB3, and I
went ahead and fixed them, and ran hg export on my changeset.
The problems were a missing linking step to -pthread on Linux, as well as some
case-sensivity issues (i.e. <slb3/implementation.h> instead of
<SLB3/implementation.h>). There was also one file that did not include
<cstring> and thus failed when trying to use a particular function.
The patch is attached, just run hg import linux_fix.hgpatch in the repo to
include it.
Original issue reported on code.google.com by [email protected]
on 19 Mar 2013 at 7:42
Attachments:
What steps will reproduce the problem?
1. Add SLB3 on a c++11 project
2. Compile it with -std=c++11 and g++ 4.7
What is the expected output? What do you see instead?
With gcc4.7 it fails to build and the error message is:
/slb_test/slb/include/SLB3/internal/../internal/value_primitives_ptr.h: In
static member function 'static void SLB3::Value<const void*>::Push(lua_State*,
const void*)':
/slb_test/slb/include/SLB3/internal/../internal/value_primitives_ptr.h:73:1:
error: unable to find string literal operator 'operator"" Name'
With gcc4.8 the same error is a warning:
/slb_test/slb/include/SLB3/info.h:175:41: warning: invalid suffix on literal;
C++11 requires a space between literal and identifier [-Wliteral-suffix]
const char* name() const { return "const "Name" &"; }
I've attached a patch that fixes the issue and it also adds a SLB3 prefix in
some macros.
Original issue reported on code.google.com by [email protected]
on 12 Dec 2013 at 2:46
Attachments:
When attempting to load a file with syntax or other errors, SLB checks the
return status of luaL_loadfile and sets _lastError appropriately. However, it
then goes on to unconditionally try to execute the loaded object, which in the
case of an error may not be a function.
The result is an unhelpful error message like
SLB Exception:
-------------------------------------------------------
Lua Error:
attempt to call a string value
Traceback:
[ 0 (C) ]
Applying a patch like
diff --git a/src/Script.cpp b/src/Script.cpp
--- a/src/Script.cpp
+++ b/src/Script.cpp
@@ -171,7 +171,7 @@ namespace SLB {
}
// otherwise...
- if( _errorHandler->call(_lua_state, 0, 0))
+ if(result && _errorHandler->call(_lua_state, 0, 0))
{
_lastError = lua_tostring(L,-1);
result = false;
seems to produce more appropriate error messages, such as
cannot open test1.lua: No such file or directory
or
test1.lua:41: syntax error near <eof>
Original issue reported on code.google.com by [email protected]
on 21 Aug 2012 at 5:10
Would it be possible to add the ability to bind a member function? There is
already the ability for a c function like:
m->set( "c_function", SLB::FuncCall::create(c_function));
But could we have something like:
struct Foo
{
int Bar(int a, int b) { return a*b; }
};
Foo f;
m->set( "Bar", SLB::FuncCall::create(Foo::Bar), &f);
Original issue reported on code.google.com by [email protected]
on 16 Feb 2012 at 4:51
Could it be possible to add support for properties?
As described there: http://lua-users.org/wiki/ObjectProperties
Original issue reported on code.google.com by [email protected]
on 1 Apr 2013 at 10:41
Google Code says license is MIT License, but code has LGPL license in it.
Original issue reported on code.google.com by [email protected]
on 21 Jul 2010 at 2:38
With SLB2 it was possible to add access to a member variable by using the
property method. I.e.
SLB::Class<ivec4>(IVEC4_LUA_TABLE_NAME, luaProgram->slbManager())
.constructor()
.set("length", &ivec3::length)
.property("x", &ivec4::x)
.property("y", &ivec4::y)
.property("z", &ivec4::z)
.property("w", &ivec4::w);
I can't find what the equivalent way of doing this in SLB3 would be.
Original issue reported on code.google.com by [email protected]
on 10 Jan 2014 at 2:26
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.