Skip to content

Commit

Permalink
add .core suffix cpp lib name
Browse files Browse the repository at this point in the history
  • Loading branch information
sniper00 committed Sep 26, 2023
1 parent a9ec0d8 commit 9d225b3
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion lualib-src/lua_http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static int lhttp_urldecode(lua_State* L)
}

extern "C" {
int LUAMOD_API luaopen_http(lua_State *L)
int LUAMOD_API luaopen_http_core(lua_State *L)
{
luaL_Reg l[] = {
{ "parse_request", lhttp_parse_request},
Expand Down
4 changes: 2 additions & 2 deletions lualib-src/lua_moon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ static int lmi_collect(lua_State* L)
}

extern "C" {
int LUAMOD_API luaopen_moon(lua_State* L)
int LUAMOD_API luaopen_moon_core(lua_State* L)
{
luaL_Reg l[] = {
{ "clock", lmoon_clock},
Expand Down Expand Up @@ -724,7 +724,7 @@ static int lasio_unpack_udp(lua_State* L)
}

extern "C" {
int LUAMOD_API luaopen_asio(lua_State* L)
int LUAMOD_API luaopen_asio_core(lua_State* L)
{
luaL_Reg l[] = {
{ "try_open", lasio_try_open},
Expand Down
2 changes: 1 addition & 1 deletion lualib/moon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require("base.math")
require("base.util")
require("base.class")

local core = require("mooncore")
local core = require("moon.core")
local seri = require("seri")

local pairs = pairs
Expand Down
10 changes: 5 additions & 5 deletions lualib/moon/api/core.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
error("DO NOT REQUIRE THIS FILE")

--- lightuserdata buffer*
---@class buffer_ptr

--- lightuserdata message*
---@meta

--- lightuserdata, cpp type `buffer*`
---@class buffer_ptr

--- lightuserdata, cpp type `message*`
---@class message_ptr

--- lightuserdata char*
--- lightuserdata, cpp type `char*`
---@class cstring_ptr

---@class core
Expand Down
6 changes: 3 additions & 3 deletions lualib/moon/http/client.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
local http = require("http")
local buffer = require("buffer")
local moon = require("moon")
local json = require("json")
local socket = require("moon.socket")
local c = require("http.core")

local string = string

Expand All @@ -14,10 +14,10 @@ local tonumber = tonumber
local tointeger = math.tointeger
local pairs = pairs

local parse_response = http.parse_response
local parse_response = c.parse_response

---@type fun(params:table):string
local create_query_string = http.create_query_string
local create_query_string = c.create_query_string

-----------------------------------------------------------------

Expand Down
7 changes: 3 additions & 4 deletions lualib/moon/http/server.lua
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
local moon = require("moon")
local http = require("http")
local buffer = require("buffer")
---@type fs
local fs = require("fs")
local socket = require("moon.socket")
local c = require("http.core")

local parse_request = http.parse_request
local parse_query_string = http.parse_query_string
local parse_request = c.parse_request
local parse_query_string = c.parse_query_string

local tbinsert = table.insert
local tbconcat = table.concat
Expand Down
2 changes: 1 addition & 1 deletion lualib/moon/socket.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local moon = require("moon")
local core = require("asio")
local core = require("asio.core")

local make_session = moon.make_session
local id = moon.id
Expand Down
13 changes: 7 additions & 6 deletions moon-src/moon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,20 +255,21 @@ int main(int argc, char* argv[])
extern "C" {
void open_custom_libs(lua_State* L)
{
//core

#ifdef LUA_CACHELIB
REGISTER_CUSTOM_LIBRARY("codecache", luaopen_cache);
#endif

REGISTER_CUSTOM_LIBRARY("mooncore", luaopen_moon);
REGISTER_CUSTOM_LIBRARY("asio", luaopen_asio);
//core
REGISTER_CUSTOM_LIBRARY("moon.core", luaopen_moon_core);
REGISTER_CUSTOM_LIBRARY("asio.core", luaopen_asio_core);
REGISTER_CUSTOM_LIBRARY("sharetable.core", luaopen_sharetable_core);
REGISTER_CUSTOM_LIBRARY("socket.core", luaopen_socket_core);
REGISTER_CUSTOM_LIBRARY("http.core", luaopen_http_core);
REGISTER_CUSTOM_LIBRARY("fs", luaopen_fs);
REGISTER_CUSTOM_LIBRARY("http", luaopen_http);
REGISTER_CUSTOM_LIBRARY("seri", luaopen_serialize);
REGISTER_CUSTOM_LIBRARY("json", luaopen_json);
REGISTER_CUSTOM_LIBRARY("buffer", luaopen_buffer);
REGISTER_CUSTOM_LIBRARY("sharetable.core", luaopen_sharetable_core);
REGISTER_CUSTOM_LIBRARY("socket.core", luaopen_socket_core);

//custom
REGISTER_CUSTOM_LIBRARY("pb", luaopen_pb);
Expand Down

0 comments on commit 9d225b3

Please sign in to comment.