Skip to content

Commit

Permalink
Test: proto to lua table
Browse files Browse the repository at this point in the history
  • Loading branch information
i0gan committed Sep 23, 2024
1 parent 103d77f commit 5b108ab
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 24 deletions.
11 changes: 10 additions & 1 deletion src/lua/test/pb.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,13 @@ function Test1()
PrintTable(test_tbl);
end

Test1()
function Test2()
print("create a blank proto struct to lua table")
local test_tbl = Squick:GetProtoTable("rpc.PlayerData")
PrintTable(test_tbl)
print("Json encode:")
print(Json.encode(test_tbl))
end

--Test1()
Test2()
3 changes: 2 additions & 1 deletion src/proto/base.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ enum ErrorCode {
ErrCommonFaild = 1;
}


message PlayerData {
string account = 1;
string account_id = 2;
Expand All @@ -38,4 +39,4 @@ message PlayerData {
int32 last_login_time = 9;
int32 last_offline_time = 10;
string platform = 11;
}
}
12 changes: 12 additions & 0 deletions src/proto/db_table.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";
package rpc;
import "base.proto";

message OnlineTable {
int64 uid = 1;
}

message PlayerTable {
int64 uid = 1; // index
PlayerData data = 2;
}
9 changes: 9 additions & 0 deletions src/proto/n_cklog.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";
package rpc;
import "base.proto";

// CKLog
message NCkLogPlayerLogin { // msg_id=52000;
int32 login_time = 1;
}

2 changes: 1 addition & 1 deletion src/proto/n_db_proxy.proto
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,4 @@ message NAckMysqlUpdate { // msg_id=30307;
int32 code = 1;
bytes msg = 2;
int32 query_id = 3;
}
}
20 changes: 0 additions & 20 deletions src/proto/n_db_table.proto

This file was deleted.

4 changes: 3 additions & 1 deletion src/proto/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@

45000 ~ 46000 : game_manager.proto

50000 ~ 50200 : test.proto
50000 ~ 50200 : test.proto

52000 - 62000 : cklog.proto

0 comments on commit 5b108ab

Please sign in to comment.