Text 如何向Roblox数据模型添加自定义数据文件?

Text 如何向Roblox数据模型添加自定义数据文件?,text,roblox,Text,Roblox,我似乎无法将文本数据(例如CSV、JSON或XML文件)添加到Roblox、工作区、服务器存储或任何地方,真的吗 关于如何有效地做到这一点,有什么提示吗? 理想的情况下,Roblox应该只给我文件的内容作为参考。但是,如果有一种方法可以从我必须手动解析的文件中获取原始字符串,我也可以处理。如果我没记错的话,Roblox只允许将他们的文件(RBXM、RBLX等)插入studio。如果它是您想要的文本文件,我建议只创建一个新的脚本实例,然后将文本复制到该脚本。您不能将“文件”添加到数据模型中。但是,

我似乎无法将文本数据(例如CSV、JSON或XML文件)添加到Roblox、
工作区、
服务器存储
或任何地方,真的吗

关于如何有效地做到这一点,有什么提示吗?
理想的情况下,Roblox应该只给我文件的内容作为参考。但是,如果有一种方法可以从我必须手动解析的文件中获取原始字符串,我也可以处理。

如果我没记错的话,Roblox只允许将他们的文件(RBXM、RBLX等)插入studio。如果它是您想要的文本文件,我建议只创建一个新的脚本实例,然后将文本复制到该脚本。

您不能将“文件”添加到数据模型中。但是,您可以使用从Web服务器(以及JSON)加载数据。 如果不希望以这种方式加载,可以使用或来存储数据

为方便起见,您可以使用(请务必阅读“嵌套引号”)如下:


使用ModuleScript:

return [[Here is your
data that can
span over multiple lines,
so just copy-paste the content]]
local data = require(game.ServerStorage.your.module.script.text.file)
print("My data: " .. data)
return game:GetService("HttpService"):JSONDecode([[Here is your
data that can
span over multiple lines,
so just copy-paste the content]])
ModuleScript的用法:

return [[Here is your
data that can
span over multiple lines,
so just copy-paste the content]]
local data = require(game.ServerStorage.your.module.script.text.file)
print("My data: " .. data)
return game:GetService("HttpService"):JSONDecode([[Here is your
data that can
span over multiple lines,
so just copy-paste the content]])

如果希望将JSON文本解码到表中:

local data = game:GetService("HttpService"):JSONDecode(require(game.ServerStorage.your.module.script.text.file))
或者在ModuleScript中:

return [[Here is your
data that can
span over multiple lines,
so just copy-paste the content]]
local data = require(game.ServerStorage.your.module.script.text.file)
print("My data: " .. data)
return game:GetService("HttpService"):JSONDecode([[Here is your
data that can
span over multiple lines,
so just copy-paste the content]])

您还可以将文本存储在