fix(antd-lua): add missing discover module to rockspec; fix example cost-table concat#76
Open
Nic-dorman wants to merge 1 commit into
Open
fix(antd-lua): add missing discover module to rockspec; fix example cost-table concat#76Nic-dorman wants to merge 1 commit into
Nic-dorman wants to merge 1 commit into
Conversation
…ost-table concatenation
The rockspec listed only 5 of the 6 .lua modules — antd.discover was
missing — so after luarocks make, require("antd") failed:
module antd.discover not found:
no file .../antd/discover.lua
Add the missing entry.
Also fix three examples that tried to concatenate a Lua table (the cost
estimate) directly to a string — same shape as #66 (PHP) and #67 (Elixir).
02-data.lua is reworked to match the Python/PHP/Elixir shape (estimate-
then-store, round-trip assertion, OK marker); 04-files.lua and 05-graph.lua
get single-line fixes.
Closes #68
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #68.
Two-part fix:
1. Rockspec gap (the headline bug).
antd-scm-1.rockspecdeclared only 5 of the 6.luamodules undersrc/antd/—antd.discoverwas missing. Afterluarocks make,require("antd")blew up immediately becauseclient.lua:10doesrequire("antd.discover")and there was no installed file for it:```
module antd.discover not found:
no file '/usr/local/share/lua/5.4/antd/discover.lua'
no file '/home/nic/.luarocks/share/lua/5.4/antd/discover.lua'
...
```
One-line rockspec addition.
2. Example cost-table stringification. Once
requireworked the example then crashed on:```
examples/02-data.lua:34: attempt to concatenate a table value (local 'cost')
```
Client:data_cost()returns a Lua table{cost, file_size, chunk_count, estimated_gas_cost_wei, payment_mode}, but the example concatenated the whole table to a string. Same shape as #66 (PHP) and #67 (Elixir).02-data.luais reworked end-to-end to match the Python/PHP/Elixir layout (estimate first, then store, then assert round-trip + OK marker).04-files.lua:43and05-graph.lua:50get single-line fixes.Test plan
luarocks --local --lua-version=5.4 makeinstalls all 6 modules in~/.luarocks/share/lua/5.4/antd/lua5.4 examples/02-data.luaagainst a local devnet — exits 0, prints estimate + address, "Public data round-trip OK!"04-filesreferences aresult.storage_cost_attofield whose presence I didn't verify here)Linux/Lua-5.4 footnote
For Linux contributors: Ubuntu's
luarockspackage defaults to Lua 5.1. To install for 5.4 specifically:luarocks --local --lua-version=5.4 make(plusapt install liblua5.4-dev). Worth a one-line mention inantd-lua/README.mdbut out of scope here.