File tree Expand file tree Collapse file tree 5 files changed +12
-5
lines changed
Expand file tree Collapse file tree 5 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ target_sources(Lute.Runtime PRIVATE
44 runtime/include/lute/require.h
55 runtime/include/lute/requireutils.h
66 runtime/include/lute/runtime.h
7+ runtime/include/lute/userdatas.h
78
89 runtime/src/options.cpp
910 runtime/src/ref.cpp
Original file line number Diff line number Diff line change 88#include " Luau/ToString.h"
99#include " Luau/Compiler.h"
1010
11+ #include " lute/userdatas.h"
12+
13+
1114#include " lua.h"
1215#include " lualib.h"
1316#include < cstddef>
@@ -1707,7 +1710,7 @@ struct AstSerialize : public Luau::AstVisitor
17071710 node->type ->visit (this );
17081711 lua_setfield (L, -2 , " type" );
17091712
1710- serializeToken (Luau::Position{node->location .end .line , node->location .end .column -1 }, " )" );
1713+ serializeToken (Luau::Position{node->location .end .line , node->location .end .column - 1 }, " )" );
17111714 lua_setfield (L, -2 , " closeParens" );
17121715 }
17131716
@@ -2190,7 +2193,7 @@ int compile_luau(lua_State* L)
21902193
21912194 std::string bytecode = Luau::compile (std::string (source, source_size), opts);
21922195
2193- std::string* userdata = static_cast <std::string*>(lua_newuserdata (L, sizeof (std::string)));
2196+ std::string* userdata = static_cast <std::string*>(lua_newuserdatatagged (L, sizeof (std::string), kCompilerResultTag ));
21942197
21952198 new (userdata) std::string (std::move (bytecode));
21962199
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ const int kDurationTag = 1 ;
4+ const int kInstantTag = 2 ;
5+ const int kCompilerResultTag = 3 ;
Original file line number Diff line number Diff line change @@ -9,9 +9,6 @@ int luaopen_time(lua_State* L);
99// open the library as a table on top of the stack
1010int luteopen_time (lua_State* L);
1111
12- static const int kDurationTag = 2 ;
13- static const int kInstantTag = 1 ;
14-
1512static const char kInstantType [] = " instant" ;
1613static const char kDurationType [] = " duration" ;
1714static const char kDurationLibraryIdentifier [] = " duration" ;
Original file line number Diff line number Diff line change 11#include " lute/time.h"
22#include " lua.h"
33#include " lualib.h"
4+ #include " lute/userdatas.h"
45#include " uv.h"
56
67#include < cmath>
You can’t perform that action at this time.
0 commit comments