- instance_v2 now includes legacy compatibility layer - All interpreter code migrated to use instance_v2 - Added legacy field access methods (get_fields, set_field_legacy, etc.) - Fixed type conversion issues (NyashValue vs SharedNyashBox) - instance.rs still exists but no longer used in interpreter - TODO: Remove instance.rs completely in next phase - TODO: Implement proper SharedNyashBox -> NyashValue conversion 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
49 lines
1.4 KiB
Plaintext
49 lines
1.4 KiB
Plaintext
// FileBox v2プラグイン メソッドテスト
|
|
print("=== FileBox Methods Test ===")
|
|
|
|
// FileBoxを作成
|
|
print("\n1. Creating FileBox...")
|
|
local fileBox
|
|
fileBox = new FileBox()
|
|
print("✅ FileBox created: " + fileBox.toString())
|
|
|
|
// ファイルを開く
|
|
print("\n2. Opening file for writing...")
|
|
local success
|
|
success = fileBox.open("test_output.txt", "w")
|
|
print("✅ File opened: " + success.toString())
|
|
|
|
// ファイルに書き込む
|
|
print("\n3. Writing to file...")
|
|
local writeResult
|
|
writeResult = fileBox.write("Hello from Nyash FileBox v2!\n")
|
|
print("✅ Written bytes: " + writeResult.toString())
|
|
|
|
// もう一行書き込む
|
|
writeResult = fileBox.write("Everything is Box! 🎉\n")
|
|
print("✅ Written more bytes: " + writeResult.toString())
|
|
|
|
// ファイルを閉じる
|
|
print("\n4. Closing file...")
|
|
local closeResult
|
|
closeResult = fileBox.close()
|
|
print("✅ File closed: " + closeResult.toString())
|
|
|
|
// ファイルを読み込みモードで開く
|
|
print("\n5. Opening file for reading...")
|
|
success = fileBox.open("test_output.txt", "r")
|
|
print("✅ File opened for reading: " + success.toString())
|
|
|
|
// ファイル内容を読む
|
|
print("\n6. Reading from file...")
|
|
local content
|
|
content = fileBox.read()
|
|
print("✅ File content:")
|
|
print(content)
|
|
|
|
// 最後にファイルを閉じる
|
|
print("\n7. Closing file again...")
|
|
closeResult = fileBox.close()
|
|
print("✅ File closed: " + closeResult.toString())
|
|
|
|
print("\n=== Test completed successfully! ===") |