Sol2: Customization point fails

Created on 1 Mar 2019  路  7Comments  路  Source: ThePhD/sol2

I tried sol3 with the new extension points.
Wrapping uint64 and int64 worked fine locally on windows and linux systems, but for some reason travis fails.

Error message:

[sol2] An error occurred and has been passed to an error handler:
  sol:
    runtime error: [string "f_maxint64_t(maxint64_t)"]:1:
      stack index 1, expected number, received int64: not an integer
stack traceback:
    [C]: in function 'f_maxint64_t'
    [string "f_maxint64_t(maxint64_t)"]:1: in main chunk

Failing line: REQUIRE_NOTHROW(lua.script("f_maxint64_t(maxint64_t)"));
In this f_maxint64_t is a function that takes int64_t as a parameter and maxint64_t is the maximum int64_t value that has been pushed to lua.
It seems that pushing the int64_t worked as expected ( it is userdata ), but checking is not working.

Failing build: https://travis-ci.com/Rochet2/sol3test/builds/102792864
code: https://github.com/Rochet2/sol3test/tree/9f14854354d9b949e0451be01eb0817747da9046
test.cpp contains the test code that fails
stackinterface.h contains the extension point code
wrap64.h contains the object that is used to represent (u)int64

Im probably not using the extension API entirely correctly, I am guessing.

Bright.Future Bug.Aaah! Bug.Oh DeaR Bug.On Fire Bug.Well Shit By.Design Help.Me! I'm.Sorry I.Must Scream But There.Is No Sound Here What.In The World

All 7 comments

You've opened Pandora's box.

I'm gonna have to write a blog post to answer this one, so it'll be a bit. This one might not be _properly_ solvable until the full release of sol3, which... is not gonna be fun.

For now, you'll have to qualify when you want special handling with wrap<> versions explicitly in the function's APIs. Sorry...!

I think this issue needs more labels.

Excellent point!

@Rochet2

There's nothing I can do without doing crazy gymnastics to help this specific case.

The fix for you is defining them by doing the following:

#include <sol/forward.hpp>

/* Forward-declare all customization points that use primitives */

#include <sol/sol.hpp>

// The rest of your code

This will allow sol2 to pick up your extension points. Note you only have to forward-declare for the primitive types like 霉int64_torstring_view` and shit.

Alright.
I updated the code with that suggestion and now linux and windows pass.
https://travis-ci.com/Rochet2/sol3test/builds/103806192
https://github.com/Rochet2/sol3test/tree/61e996167481dd9c611678c65d95eadda6b4fab8

An unrelated issue:
I also updated to latest sol3, but then windows fails, so keeping on the older version. https://travis-ci.com/Rochet2/sol3test/builds/103805661
https://github.com/Rochet2/sol3test/tree/155ca3575e989f99503b2cde1b2ea046ad35644a
Seems the latest update broke VS build.

@Rochet2 Don't know what's wrong: it looks like a really bad compiler bug, and I don't know how to fix it honestly.

@Rochet2 Should be fixed now but I probably borked clang, kek.

Oh well!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

patlecat picture patlecat  路  7Comments

spin-scenario picture spin-scenario  路  5Comments

hmenke picture hmenke  路  6Comments

shohnwal picture shohnwal  路  10Comments

sagunkho picture sagunkho  路  4Comments