-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: table supported circular dependencies
- Loading branch information
Showing
4 changed files
with
78 additions
and
85 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,19 @@ | ||
import { Lua } from '../dist/index.js'; | ||
|
||
// This file was created as a sandbox to test and debug on vscode | ||
const lua = await Lua.create({ openStandardLibraries: true }); | ||
lua.global.loadLibrary(); | ||
lua.ctx.t = { test: 1 }; | ||
lua.ctx.tet = () => { | ||
return lua.ctx.t; | ||
}; | ||
await lua.doString('return tet(2)'); | ||
const value = await lua.doString('return tet(2)'); | ||
console.log(value); | ||
// await lua.doString('print(getmetatable(p))'); | ||
// await lua.doString('print(getmetatable(p).__index)'); | ||
// await lua.doString('print(getmetatable(p).__index(x))'); | ||
// await lua.doString('print(p.x)'); | ||
// lua.ctx.test = () => { | ||
// return { | ||
// aaaa: 1, | ||
// bbb: 'hey', | ||
// test() { | ||
// return 22; | ||
// }, | ||
// }; | ||
// }; | ||
const lua = await Lua.create(); | ||
|
||
// await lua.doString('print(test)'); | ||
// await lua.doString('print(test())'); | ||
// await lua.doString('print(test().test())'); | ||
const a = { name: 'a' }; | ||
const b = { name: 'b' }; | ||
b.a = a; | ||
a.b = b; | ||
|
||
lua.global.pushValue(a); | ||
// lua.global.luaApi.lua_setglobal(lua.global.address, 'x'); | ||
// lua.doStringSync(` | ||
// print(x.b.a.b.a) | ||
// `); | ||
const res = lua.global.getValue(-1); | ||
|
||
//console.log(res.b.a); | ||
console.log(res); |
This file contains 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